<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Programming &#8211; G1FEF</title>
	<atom:link href="https://g1fef.co.uk/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>https://g1fef.co.uk</link>
	<description></description>
	<lastBuildDate>Thu, 14 May 2020 12:02:34 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9</generator>
	<item>
		<title>Turning POE on and off on the Cisco 3750 via SNMP</title>
		<link>https://g1fef.co.uk/turning-poe-on-and-off-on-the-cisco-3750-via-snmp/</link>
		
		<dc:creator><![CDATA[G1FEF]]></dc:creator>
		<pubDate>Sat, 08 Sep 2018 09:03:07 +0000</pubDate>
				<category><![CDATA[Programming]]></category>
		<guid isPermaLink="false">https://g1fef.co.uk/?p=193</guid>

					<description><![CDATA[I recently had a requirement to be able to turn the POE power off / on on specific ports on a remote c3750 POE switch in order to reboot devices that kept crashing. I had been remotely logging in via SSH and doing the following to turn the power off on port 1: configure terminal [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>I recently had a requirement to be able to turn the POE power off / on on specific ports on a remote c3750 POE switch in order to reboot devices that kept crashing.<br />
<span id="more-193"></span></p>
<p>I had been remotely logging in via SSH and doing the following to turn the power off on port 1:</p>
<pre class="text">

configure terminal
interface FastEthernet1/0/1
power inline never
exit
exit
</pre>
<p>Then after a few seconds:</p>
<pre class="text">

configure terminal
interface FastEhernet1/0/1
no power inline never
exit
exit
</pre>
<p>This got to be a real nuisance so I looked for something that I could script, SNMP seemed the logical choice. The first step is to configure a R/W community string on the switch:</p>
<pre class="text">

configure terminal
snmp-server community MyCommunityString rw
exit
write memory
</pre>
<p>After a bit of digging I found the appropriate OID by using snmpwalk (here we assume my switch is on IP address 1.2.3.4):</p>
<pre class="text">

snmpwalk -v2c -On -c MyCommunityString 1.2.3.4 1.3.6.1.2.1.105.1.1.1.3.1
</pre>
<p>My 24 port switch returned the following:</p>
<p>.1.3.6.1.2.1.105.1.1.1.3.1.3 = INTEGER: 1<br />
.1.3.6.1.2.1.105.1.1.1.3.1.4 = INTEGER: 1<br />
.1.3.6.1.2.1.105.1.1.1.3.1.5 = INTEGER: 1<br />
.1.3.6.1.2.1.105.1.1.1.3.1.6 = INTEGER: 1<br />
.1.3.6.1.2.1.105.1.1.1.3.1.7 = INTEGER: 1<br />
.1.3.6.1.2.1.105.1.1.1.3.1.8 = INTEGER: 1<br />
.1.3.6.1.2.1.105.1.1.1.3.1.9 = INTEGER: 1<br />
.1.3.6.1.2.1.105.1.1.1.3.1.10 = INTEGER: 1<br />
.1.3.6.1.2.1.105.1.1.1.3.1.11 = INTEGER: 1<br />
.1.3.6.1.2.1.105.1.1.1.3.1.12 = INTEGER: 1<br />
.1.3.6.1.2.1.105.1.1.1.3.1.13 = INTEGER: 1<br />
.1.3.6.1.2.1.105.1.1.1.3.1.14 = INTEGER: 1<br />
.1.3.6.1.2.1.105.1.1.1.3.1.15 = INTEGER: 1<br />
.1.3.6.1.2.1.105.1.1.1.3.1.16 = INTEGER: 1<br />
.1.3.6.1.2.1.105.1.1.1.3.1.17 = INTEGER: 1<br />
.1.3.6.1.2.1.105.1.1.1.3.1.18 = INTEGER: 1<br />
.1.3.6.1.2.1.105.1.1.1.3.1.19 = INTEGER: 1<br />
.1.3.6.1.2.1.105.1.1.1.3.1.20 = INTEGER: 1<br />
.1.3.6.1.2.1.105.1.1.1.3.1.21 = INTEGER: 1<br />
.1.3.6.1.2.1.105.1.1.1.3.1.22 = INTEGER: 1<br />
.1.3.6.1.2.1.105.1.1.1.3.1.23 = INTEGER: 1<br />
.1.3.6.1.2.1.105.1.1.1.3.1.24 = INTEGER: 1<br />
.1.3.6.1.2.1.105.1.1.1.3.1.25 = INTEGER: 1<br />
.1.3.6.1.2.1.105.1.1.1.3.1.26 = INTEGER: 1</p>
<p>The port number go from .3 to .26 corresponding to the 24 FastEthernet ports.</p>
<p>The integer values need to be 1 to enable POE and 2 to disable it.</p>
<p>So using snmpset we can turn the power on port 1 off:</p>
<pre class="text">

snmpset -v2c -c MyCommunityString 1.2.3.4 1.3.6.1.2.1.105.1.1.1.3.1.7 i 2
</pre>
<p>and back on again:</p>
<pre class="text">

snmpset -v2c -c MyCommunityString 1.2.3.4 1.3.6.1.2.1.105.1.1.1.3.1.7 i 1
</pre>
<p>That&#8217;s it! Simple really. Adding the commands to a script I will leave to the imagination of the reader&#8230;</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>GNU screen scrollback and other navigation</title>
		<link>https://g1fef.co.uk/gnu-screen-scrollback-navigation/</link>
		
		<dc:creator><![CDATA[G1FEF]]></dc:creator>
		<pubDate>Sun, 16 Apr 2017 13:25:33 +0000</pubDate>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[System admin]]></category>
		<guid isPermaLink="false">https://g1fef.co.uk/?p=65</guid>

					<description><![CDATA[GNU screen commands The GNU screen program has some useful navigation facilities. To enter COPY MODE you need to press CTRL + A + [ Once in copy mode use the keys below to navigate: h Move the cursor left by one character j Move the cursor down by one line k Move the cursor [&#8230;]]]></description>
										<content:encoded><![CDATA[<h4>GNU screen commands</h4>
<p><span id="more-65"></span></p>
<p>The GNU screen program has some useful navigation facilities. To enter COPY MODE you need to press CTRL + A + [</p>
<p>Once in copy mode use the keys below to navigate:</p>
<table class="table table-hover">
<tbody>
<tr>
<td>h</td>
<td>Move the cursor left by one character</td>
</tr>
<tr>
<td>j</td>
<td>Move the cursor down by one line</td>
</tr>
<tr>
<td>k</td>
<td>Move the cursor up by one line</td>
</tr>
<tr>
<td>l</td>
<td>Move the cursor right by one character</td>
</tr>
<tr>
<td>0</td>
<td>Move to the beginning of the current line</td>
</tr>
<tr>
<td>$</td>
<td>Move to the end of the current line</td>
</tr>
<tr>
<td>G</td>
<td>Moves to the specified line</td>
</tr>
<tr>
<td>C-u</td>
<td>Scrolls a half page up</td>
</tr>
<tr>
<td>C-b</td>
<td>Scrolls a full page up</td>
</tr>
<tr>
<td>C-d</td>
<td>Scrolls a half page down</td>
</tr>
<tr>
<td>C-f</td>
<td>Scrolls the full page down</td>
</tr>
</tbody>
</table>
<p>When starting screen you can set the size of the scrollback buffer by using the -h command line argument, for example to set the scrollback buffer to 1000 lines:</p>
<p>screen -h 1000</p>
<p>This can also be set in .screenrc with defscrollback</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Adding a new SVN repo</title>
		<link>https://g1fef.co.uk/adding-a-new-svn-repo/</link>
		
		<dc:creator><![CDATA[G1FEF]]></dc:creator>
		<pubDate>Thu, 23 Mar 2017 14:51:54 +0000</pubDate>
				<category><![CDATA[Programming]]></category>
		<guid isPermaLink="false">https://g1fef.co.uk/?p=49</guid>

					<description><![CDATA[How to create a new SVN repository     On the local machine the svn server is on: Create the new repo: # svnadmin create /path/to/repo/reponame Change ownership to web daemon: # chown -R apache.apache /path/to/repo/reponame Switch to svn account: # su - svn Edit policy file to give users access: # vim .svn-policy-file Add [&#8230;]]]></description>
										<content:encoded><![CDATA[<h4>How to create a new SVN repository</h4>
<p> </p>
<h4><span id="more-49"></span></h4>
<p> </p>
<p>On the local machine the svn server is on:</p>
<p>Create the new repo:</p>
<pre class="lang:bash"># svnadmin create /path/to/repo/reponame
</pre>
<p>Change ownership to web daemon:</p>
<pre class="lang:bash"># chown -R apache.apache /path/to/repo/reponame
</pre>
<p>Switch to svn account:</p>
<pre class="lang:bash"># su - svn
</pre>
<p>Edit policy file to give users access:</p>
<pre class="lang:bash"># vim .svn-policy-file
</pre>
<p>Add access to the repo, e.g.</p>
<pre class="lang:bash">[reponame:/]
username = rw
</pre>
<p>Now a new project can be committed to the repo.</p>


<p>To upload an existing directory tree from a server:</p>



<ul class="wp-block-list"><li>Create new, empty folder in repo:<ul><li>svn mkdir https://svn.host.com/svn_path/newApp</li></ul></li><li>Go to parent directory on server</li><li>Checkout the repo over your existing folder:<ul><li>svn co https://svn.host.com/svn_path/newApp</li></ul></li><li>Use svn add to add new files</li><li>Use commit to upload</li></ul>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
