<?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>dopefish.de</title>
	<atom:link href="http://www.dopefish.de/feed" rel="self" type="application/rss+xml" />
	<link>http://www.dopefish.de</link>
	<description>Headquaters of the evil genius</description>
	<lastBuildDate>Mon, 23 Jan 2012 13:34:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Playing around with DD-WRT</title>
		<link>http://www.dopefish.de/archives/1088</link>
		<comments>http://www.dopefish.de/archives/1088#comments</comments>
		<pubDate>Sat, 24 Dec 2011 15:45:44 +0000</pubDate>
		<dc:creator>dopefish</dc:creator>
				<category><![CDATA[Me]]></category>
		<category><![CDATA[access point]]></category>
		<category><![CDATA[asus]]></category>
		<category><![CDATA[dd-wrt]]></category>
		<category><![CDATA[IDS]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[wifi]]></category>
		<category><![CDATA[wlan]]></category>

		<guid isPermaLink="false">http://www.dopefish.de/?p=1088</guid>
		<description><![CDATA[I&#8217;m currently playing around with my two WL-330GE Access points from asus (see an older posting). Since that posting I was a bit creative using the existing ethernet cabling and ports in the apartment to be able to retire the WiFi bridge without having any cable going through the apartment.
So I decided to use the two access [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m currently playing around with my two <a href="http://www.asus.com/Networks/Wireless_Routers/WL330gE/" target="_blank">WL-330GE Access points</a> from asus (see an <a title="Wireless bridge &amp; dd-wrt" href="http://www.dopefish.de/archives/814" target="_blank">older posting</a>). Since that posting I was a bit creative using the existing ethernet cabling and ports in the apartment to be able to retire the WiFi bridge without having any cable going through the apartment.</p>
<p>So I decided to use the two access points for something more useful. I&#8217;m playing around with <a href="http://www.dd-wrt.com/site/index" target="_blank">dd-wrt</a> to build configurations to use them as WiFi probes (for an IDS), or as Rouge Access Points (for demonstration purposes and to test wireless IDS solutions).  I might compile my own dd-wrt version for the rouge version, there are a few things I miss to build a truly evil device.</p>
<p>I like the size of the devices (very compact) and that you can power them with 5V (you can run them off any USB port, right now the one here is hooked up to the USB port of a printer intended for cameras) the only thing missing to make them perfect would be Power-over-Ethernet and maybe a GSM interface to upload data online.</p>
<p>Fun having a cheap and small device like this with Wifi and ethernet running linux. Provides lots of possibilities and fun.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dopefish.de/archives/1088/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to make a wonderful cookie dessert in a skillet</title>
		<link>http://www.dopefish.de/archives/1082</link>
		<comments>http://www.dopefish.de/archives/1082#comments</comments>
		<pubDate>Mon, 12 Dec 2011 19:09:30 +0000</pubDate>
		<dc:creator>dopefish</dc:creator>
				<category><![CDATA[Me]]></category>
		<category><![CDATA[Photography]]></category>
		<category><![CDATA[cookie]]></category>
		<category><![CDATA[photography]]></category>
		<category><![CDATA[skillet]]></category>

		<guid isPermaLink="false">http://www.dopefish.de/?p=1082</guid>
		<description><![CDATA[A few weeks ago I stumbled across this recipe for making a cookie in a skillet http://www.sophistimom.com/one-pan-skillet-cookie and shared it with a few people because I though it looked cool. My wonderful wife then put &#8220;skillet&#8221; on our shopping list because she knows I can&#8217;t resist cookies, and yesterday we tried out the recipe. It was easy and [...]]]></description>
			<content:encoded><![CDATA[<p>A few weeks ago I stumbled across this recipe for making a cookie in a skillet <a href="http://www.sophistimom.com/one-pan-skillet-cookie/">http://www.sophistimom.com/one-pan-skillet-cookie</a> and shared it with a few people because I though it looked cool. My wonderful wife then put &#8220;skillet&#8221; on our shopping list because she knows I can&#8217;t resist cookies, and yesterday we tried out the recipe. It was easy and tasted wonderful <img src='http://www.dopefish.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Below are some pics of the treat.</p>

<div class="ngg-albumoverview">		

	<!-- List of galleries -->
		
	<div class="ngg-album-dopefish">
		<div class="ngg-album-dopefishbox">
			<div class="ngg-album-link">
				<a class="Link" href="http://www.dopefish.de/pictures-bilder/skilletcookie">
					<img class="Thumb" alt="Skillet Cookie" src="http://www.dopefish.de/wp-content/gallery/skilletcookie/thumbs/thumbs_dsc_1810.jpg"/>
				</a>
			</div>
		</div>
	</div>
	<div class="ngg-album-dopefishdescription">
	<h4><a class="ngg-album-dopefishdesc" title="Skillet Cookie" href="http://www.dopefish.de/pictures-bilder/skilletcookie" >Skillet Cookie</a></h4>
		<p><strong>10</strong> Photos</p>
		</div>

 	 	
	<!-- Pagination -->
 	<div class="ngg-clear"></div>
</div>


]]></content:encoded>
			<wfw:commentRss>http://www.dopefish.de/archives/1082/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to increase Fraps performance with a ramdisk</title>
		<link>http://www.dopefish.de/archives/1065</link>
		<comments>http://www.dopefish.de/archives/1065#comments</comments>
		<pubDate>Thu, 10 Nov 2011 02:30:54 +0000</pubDate>
		<dc:creator>dopefish</dc:creator>
				<category><![CDATA[Gaming]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[battlefield 3]]></category>
		<category><![CDATA[fraps]]></category>
		<category><![CDATA[IO]]></category>
		<category><![CDATA[powershell]]></category>
		<category><![CDATA[ramdisk]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.dopefish.de/?p=1065</guid>
		<description><![CDATA[I recently started playing Battlefield 3 and remembered that I have a Fraps license so I installed it and started recording some stuff. Unsurprisingly the performance made a big dip when I recorded. A glance at my PC told me the harddrive was at fault, probably bringing the whole system down due to IO.
Since my PC has [...]]]></description>
			<content:encoded><![CDATA[<p>I recently started playing <a title="Battlefield 3" href="http://www.battlefield.com/battlefield3" target="_blank">Battlefield 3</a> and remembered that I have a <a title="Fraps" href="http://fraps.com/" target="_blank">Fraps</a> license so I installed it and started recording some stuff. Unsurprisingly the performance made a big dip when I recorded. A glance at my PC told me the harddrive was at fault, probably bringing the whole system down due to IO.</p>
<p>Since my PC has more than enough RAM I decided to set up a 5Gb <a href="http://www.ltr-data.se/opencode.html/#ImDisk" target="_blank">Ramdisk</a> to see if that helped. It did, when writing the video files to the ramdisk I hardly had any performance hit. Unfortunately 5GB isn&#8217;t going to last long while recording 1920&#215;1080 @ 40FPS (a few minutes footage at most).</p>
<p>Here is my little cmd file to create a 5GB ramdisk as drive J: and format it for usage:</p>

<div class="my_syntax_box"><span class="my_syntax_selecall"><a href="javascript:;" onclick="selectCode(this); return false;">Select All</a> </span><span class="my_syntax_Bar">Code:</span><div class="my_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="winbatch" style="font-family:monospace;">imdisk <span style="color: #66cc66;">-</span>d <span style="color: #66cc66;">-</span>m J<span style="color: #FF1010; font-weight: bold;">:</span>
imdisk <span style="color: #66cc66;">-</span>a <span style="color: #66cc66;">-</span>t vm <span style="color: #66cc66;">-</span>s 5G <span style="color: #66cc66;">-</span>o rw <span style="color: #66cc66;">-</span>m J<span style="color: #FF1010; font-weight: bold;">:</span>
format J<span style="color: #FF1010; font-weight: bold;">: /A:64k /V:Ramdisk /FS:NTFS /Q</span></pre></td></tr></table></div></div>

<p>So my next thought was to see if I could write a script to move files off the ramdisk when they were done being written to by Fraps. This obviously was going to cause IO load &#8230; the reason we were having performance issues in the first place, so I was skeptical about if this was going to help any. Especially since I also had to move the files away quick enough so that the drive wouldn&#8217;t fill up completely with the next file Fraps was writing. I wrote a little <a href="http://en.wikipedia.org/wiki/Windows_PowerShell" target="_blank">powershell</a> script for this (yeah, a *nix Sysadmin writing scripts in powershell &#8230;)</p>
<p>Here is my little powershell script to copy the finished files from my ramdisk to a normal HDD (please excuse  possible ugliness, I&#8217;m a powershell noob):</p>

<div class="my_syntax_box"><span class="my_syntax_selecall"><a href="javascript:;" onclick="selectCode(this); return false;">Select All</a> </span><span class="my_syntax_Bar">Code:</span><div class="my_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
</pre></td><td class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #800080;">$source</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;j:\*.avi&quot;</span>
<span style="color: #800080;">$target_dir</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;f:\fraps\movies\&quot;</span>
&nbsp;
<span style="color: #0000FF;">while</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$true</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
    <span style="color: #800080;">$files</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">gci</span> <span style="color: #800080;">$source</span>
    <span style="color: #0000FF;">foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$file</span> <span style="color: #0000FF;">in</span> <span style="color: #800080;">$files</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span> 
        <span style="color: #800080;">$srcfile</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">echo</span> <span style="color: #800080;">$file</span>.fullname
        <span style="color: #800080;">$dstfile</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">echo</span> <span style="color: #800080;">$file</span>.basename
        <span style="color: #0000FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$srcfile</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
            try <span style="color: #000000;">&#123;</span>
                <span style="color: #008080; font-weight: bold;">move-item</span> <span style="color: #800000;">&quot;$srcfile&quot;</span> <span style="color: #800000;">&quot;$target_dir$dstfile.avi&quot;</span> <span style="color: pink;">-</span>ea stop
                <span style="color: #800000;">&quot;$srcfile Moved&quot;</span>
            <span style="color: #000000;">&#125;</span>
            catch <span style="color: #000000;">&#123;</span>
                <span style="color: #800000;">&quot;$srcfile in use, cannot be copied right now&quot;</span>
            <span style="color: #000000;">&#125;</span>
        <span style="color: #000000;">&#125;</span>
    <span style="color: #000000;">&#125;</span>
    <span style="color: #008080; font-weight: bold;">sleep</span> <span style="color: #804000;">5</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div></div>

<p>The last little problem I noticed is that the 5GB ramdrive wasn&#8217;t big enough (Fraps seems to create some dummy files and fills them up). Forcing Fraps to make smaller files by toggeling the recording fixed that though -&gt; pressing F9 twice fast will drop a few frames though. I used my Logitech G13 for that, just had a key mapped to press F9 quickly every 60 seconds. The shortest gap I could get working reliably is 50ms.</p>
<p><img class="aligncenter size-full wp-image-1073" title="fraps settings" src="http://www.dopefish.de/wp-content/uploads/2011/11/20111110_fraps.jpg" alt="" width="400" height="533" /></p>
<p>This all probably sounds awfully complicated, but it works and solves my problem. Fraps is great software, but it would be immensly helpful if you could set the file size in the settings (instead of it defaulting to 4GB). Or, even better, if Fraps could rework their IO system to work more efficiently.</p>
<p>So to sum everything up:<br />
- create ramdrive<br />
- start script that copies files from the ramdrive to a normal HDD<br />
- set fraps to store videos on the ramdrive<br />
- start game, press F9 to start recording and then press the G13 key to toggle the F9 periodically</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dopefish.de/archives/1065/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Yellowstone and Grand Teton Parks</title>
		<link>http://www.dopefish.de/archives/1059</link>
		<comments>http://www.dopefish.de/archives/1059#comments</comments>
		<pubDate>Mon, 03 Oct 2011 21:41:33 +0000</pubDate>
		<dc:creator>dopefish</dc:creator>
				<category><![CDATA[Me]]></category>
		<category><![CDATA[Photography]]></category>
		<category><![CDATA[Grand Teton]]></category>
		<category><![CDATA[photography]]></category>
		<category><![CDATA[Yellowstone]]></category>

		<guid isPermaLink="false">http://www.dopefish.de/?p=1059</guid>
		<description><![CDATA[A few weeks ago we traveled a bit west and visited the Yellowstone and Grand Teton National Parks, I&#8217;ve finally gotten around to sorting through the pictures and uploading a few (well, actually a lot). 
I didn&#8217;t get around to editing and stitching the panorama photos together yet, or doing anything interesting with the GPS [...]]]></description>
			<content:encoded><![CDATA[<p>A few weeks ago we traveled a bit west and visited the Yellowstone and Grand Teton National Parks, I&#8217;ve finally gotten around to sorting through the pictures and uploading a few (well, actually a lot). </p>

<div class="ngg-albumoverview">		

	<!-- List of galleries -->
		
	<div class="ngg-album-dopefish">
		<div class="ngg-album-dopefishbox">
			<div class="ngg-album-link">
				<a class="Link" href="http://www.dopefish.de/pictures-bilder/yellowstone-and-grand-teton-national-parks">
					<img class="Thumb" alt="Yellowstone and Grand Teton" src="http://www.dopefish.de/wp-content/gallery/yellowstone/thumbs/thumbs_dsc_1695.jpg"/>
				</a>
			</div>
		</div>
	</div>
	<div class="ngg-album-dopefishdescription">
	<h4><a class="ngg-album-dopefishdesc" title="Yellowstone and Grand Teton" href="http://www.dopefish.de/pictures-bilder/yellowstone-and-grand-teton-national-parks" >Yellowstone and Grand Teton</a></h4>
		<p><strong>190</strong> Photos</p>
		</div>

 	 	
	<!-- Pagination -->
 	<div class="ngg-clear"></div>
</div>


<p>I didn&#8217;t get around to editing and stitching the panorama photos together yet, or doing anything interesting with the GPS data of our hikes yet. If I get that done I&#8217;ll probably update this posting.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dopefish.de/archives/1059/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>rcon.c sorcecode (for linux)</title>
		<link>http://www.dopefish.de/archives/1052</link>
		<comments>http://www.dopefish.de/archives/1052#comments</comments>
		<pubDate>Tue, 27 Sep 2011 20:39:44 +0000</pubDate>
		<dc:creator>dopefish</dc:creator>
				<category><![CDATA[Me]]></category>

		<guid isPermaLink="false">http://www.dopefish.de/?p=1052</guid>
		<description><![CDATA[Searching for a linux command line rcon tool can be a bit of a pain: dead links, outdated versions not working anymore, stuff written in php &#8230;. yeah. The only version I could find was stuck in a cache of an old webpage. So here is my mirror of the http://www.asyserver.com/~cstrike/rcon.c file that currently gives [...]]]></description>
			<content:encoded><![CDATA[<p>Searching for a linux command line rcon tool can be a bit of a pain: dead links, outdated versions not working anymore, stuff written in php &#8230;. yeah. The only version I could find was stuck in a cache of an old webpage. So here is my mirror of the http://www.asyserver.com/~cstrike/rcon.c file that currently gives you a &#8220;404, File not found&#8221; error. Hopefully this will help anyone trying to find a working version via google and is frustrated with the results. Download, compile, happiness ensured.</p>
<p><a href="http://www.dopefish.de/files/rcon.c">http://www.dopefish.de/files/rcon.c</a></p>

<div class="my_syntax_box"><span class="my_syntax_selecall"><a href="javascript:;" onclick="selectCode(this); return false;">Select All</a> </span><span class="my_syntax_Bar">Code:</span><div class="my_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
</pre></td><td class="code"><pre class="c" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/*
# This is a simple linux command line utility to execute rcon commands
# Just change the YOUR_PASSWORD_HERE to your rcon password (unless
# you want to enter it every time) and possibly change the default
# IP address from 127.0.0.1 (localhost)
#
# once downloaded on your linux system, compile it with:
#
#   gcc -o rcon rcon.c
#
# note, it should work on non-linux too, but may require changing the 
# socket stuff (i.e. windows will definitely need to add the winsock
# initialization line)
#
# written by [ASY]Zyrain
#
*/</span>
<span style="color: #339933;">#include &lt;stdio.h&gt;</span>
<span style="color: #339933;">#include &lt;stdlib.h&gt;</span>
<span style="color: #339933;">#include &lt;sys/socket.h&gt;</span>
<span style="color: #339933;">#include &lt;sys/types.h&gt;</span>
<span style="color: #339933;">#include &lt;netinet/in.h&gt;</span>
<span style="color: #339933;">#include &lt;arpa/inet.h&gt;</span>
<span style="color: #339933;">#include &lt;errno.h&gt;</span>
<span style="color: #339933;">#include &lt;string.h&gt;</span>
&nbsp;
<span style="color: #339933;">#define DEBUG 0</span>
&nbsp;
<span style="color: #339933;">#define SERVERDATA_EXECCOMMAND 2</span>
<span style="color: #339933;">#define SERVERDATA_AUTH 3</span>
<span style="color: #339933;">#define SERVERDATA_RESPONSE_VALUE 0</span>
<span style="color: #339933;">#define SERVERDATA_AUTH_RESPONSE 2</span>
&nbsp;
<span style="color: #993333;">int</span> send_rcon<span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> sock<span style="color: #339933;">,</span> <span style="color: #993333;">int</span> id<span style="color: #339933;">,</span> <span style="color: #993333;">int</span> command<span style="color: #339933;">,</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>string1<span style="color: #339933;">,</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>string2<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #993333;">int</span> size<span style="color: #339933;">,</span> ret<span style="color: #339933;">;</span>
  size <span style="color: #339933;">=</span> <span style="color: #0000dd;">10</span><span style="color: #339933;">+</span><span style="color: #000066;">strlen</span><span style="color: #009900;">&#40;</span>string1<span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #000066;">strlen</span><span style="color: #009900;">&#40;</span>string2<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  ret <span style="color: #339933;">=</span> send<span style="color: #009900;">&#40;</span>sock<span style="color: #339933;">,&amp;</span>size<span style="color: #339933;">,</span><span style="color: #993333;">sizeof</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>ret <span style="color: #339933;">==</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066;">perror</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;send() failed:&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  ret <span style="color: #339933;">=</span> send<span style="color: #009900;">&#40;</span>sock<span style="color: #339933;">,&amp;</span>id<span style="color: #339933;">,</span><span style="color: #993333;">sizeof</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>ret <span style="color: #339933;">==</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066;">perror</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;send() failed:&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  ret <span style="color: #339933;">=</span> send<span style="color: #009900;">&#40;</span>sock<span style="color: #339933;">,&amp;</span>command<span style="color: #339933;">,</span><span style="color: #993333;">sizeof</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>ret <span style="color: #339933;">==</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066;">perror</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;send() failed:&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  ret <span style="color: #339933;">=</span> send<span style="color: #009900;">&#40;</span>sock<span style="color: #339933;">,</span>string1<span style="color: #339933;">,</span><span style="color: #000066;">strlen</span><span style="color: #009900;">&#40;</span>string1<span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #0000dd;">1</span><span style="color: #339933;">,</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>ret <span style="color: #339933;">==</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066;">perror</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;send() failed:&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  ret <span style="color: #339933;">=</span> send<span style="color: #009900;">&#40;</span>sock<span style="color: #339933;">,</span>string2<span style="color: #339933;">,</span><span style="color: #000066;">strlen</span><span style="color: #009900;">&#40;</span>string2<span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #0000dd;">1</span><span style="color: #339933;">,</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>ret <span style="color: #339933;">==</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066;">perror</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;send() failed:&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>DEBUG<span style="color: #009900;">&#41;</span> <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Sent %d bytes<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span>size<span style="color: #339933;">+</span><span style="color: #0000dd;">4</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #993333;">int</span> recv_rcon<span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> sock<span style="color: #339933;">,</span> <span style="color: #993333;">int</span> timeout<span style="color: #339933;">,</span> <span style="color: #993333;">int</span> <span style="color: #339933;">*</span>id<span style="color: #339933;">,</span> <span style="color: #993333;">int</span> <span style="color: #339933;">*</span>command<span style="color: #339933;">,</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>string1<span style="color: #339933;">,</span>
	      <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>string2<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #993333;">struct</span> timeval tv<span style="color: #339933;">;</span>
  fd_set readfds<span style="color: #339933;">;</span>
  <span style="color: #993333;">int</span> size<span style="color: #339933;">;</span>
  <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>ptr<span style="color: #339933;">;</span>
  <span style="color: #993333;">int</span> ret<span style="color: #339933;">;</span>
  <span style="color: #993333;">char</span> buf<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">8192</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
  size<span style="color: #339933;">=</span><span style="color: #208080;">0xDEADBEEF</span><span style="color: #339933;">;</span>
  <span style="color: #339933;">*</span>id<span style="color: #339933;">=</span><span style="color: #208080;">0xDEADBEEF</span><span style="color: #339933;">;</span>
  <span style="color: #339933;">*</span>command<span style="color: #339933;">=</span><span style="color: #208080;">0xDEADBEEF</span><span style="color: #339933;">;</span>
  string1<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
  string2<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
&nbsp;
  tv.<span style="color: #202020;">tv_sec</span> <span style="color: #339933;">=</span> timeout<span style="color: #339933;">;</span>
  tv.<span style="color: #202020;">tv_usec</span> <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
&nbsp;
  FD_ZERO<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span>readfds<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  FD_SET<span style="color: #009900;">&#40;</span>sock<span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span>readfds<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #808080; font-style: italic;">/* don't care about writefds and exceptfds: */</span>
  select<span style="color: #009900;">&#40;</span>sock<span style="color: #339933;">+</span><span style="color: #0000dd;">1</span><span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span>readfds<span style="color: #339933;">,</span> NULL<span style="color: #339933;">,</span> NULL<span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span>tv<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>FD_ISSET<span style="color: #009900;">&#40;</span>sock<span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span>readfds<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>DEBUG<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
      <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;recv timeout<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// timeout</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>DEBUG<span style="color: #009900;">&#41;</span> <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Got a response<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  ret <span style="color: #339933;">=</span> recv<span style="color: #009900;">&#40;</span>sock<span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span>size<span style="color: #339933;">,</span> <span style="color: #993333;">sizeof</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>ret <span style="color: #339933;">==</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066;">perror</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;recv() failed:&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>size<span style="color: #339933;">&lt;</span><span style="color: #0000dd;">10</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #009900;">&#40;</span>size<span style="color: #339933;">&gt;</span><span style="color: #0000dd;">8192</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Illegal size %d<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span>size<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000066;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  ret <span style="color: #339933;">=</span> recv<span style="color: #009900;">&#40;</span>sock<span style="color: #339933;">,</span> id<span style="color: #339933;">,</span> <span style="color: #993333;">sizeof</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>ret <span style="color: #339933;">==</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066;">perror</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;recv() failed:&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  size<span style="color: #339933;">-=</span>ret<span style="color: #339933;">;</span>
  ret <span style="color: #339933;">=</span> recv<span style="color: #009900;">&#40;</span>sock<span style="color: #339933;">,</span> command<span style="color: #339933;">,</span> <span style="color: #993333;">sizeof</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>ret <span style="color: #339933;">==</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066;">perror</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;recv() failed:&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  size<span style="color: #339933;">-=</span>ret<span style="color: #339933;">;</span>
&nbsp;
  ptr <span style="color: #339933;">=</span> buf<span style="color: #339933;">;</span>
  <span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span>size<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    ret <span style="color: #339933;">=</span> recv<span style="color: #009900;">&#40;</span>sock<span style="color: #339933;">,</span> ptr<span style="color: #339933;">,</span> size<span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>ret <span style="color: #339933;">==</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000066;">perror</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;recv() failed:&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">return</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    size <span style="color: #339933;">-=</span> ret<span style="color: #339933;">;</span> 
    ptr <span style="color: #339933;">+=</span> ret<span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  buf<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">8190</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
  buf<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">8191</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000066;">strncpy</span><span style="color: #009900;">&#40;</span>string1<span style="color: #339933;">,</span> buf<span style="color: #339933;">,</span> <span style="color: #0000dd;">4095</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  string1<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">4095</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
  <span style="color: #000066;">strncpy</span><span style="color: #009900;">&#40;</span>string2<span style="color: #339933;">,</span> buf<span style="color: #339933;">+</span><span style="color: #000066;">strlen</span><span style="color: #009900;">&#40;</span>string1<span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #0000dd;">1</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">4095</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* This is set to 1 when we've been authorized */</span>
<span style="color: #993333;">int</span> auth <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
<span style="color: #993333;">char</span> string1<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">4096</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #993333;">char</span> string2<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">4096</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #993333;">int</span> process_response<span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> sock<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #993333;">int</span> ret<span style="color: #339933;">;</span>
  <span style="color: #993333;">int</span> id<span style="color: #339933;">;</span>
  <span style="color: #993333;">int</span> command<span style="color: #339933;">;</span>
&nbsp;
  ret<span style="color: #339933;">=</span>recv_rcon<span style="color: #009900;">&#40;</span>sock<span style="color: #339933;">,</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span>id<span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span>command<span style="color: #339933;">,</span> string1<span style="color: #339933;">,</span> string2<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>DEBUG<span style="color: #009900;">&#41;</span> <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Received = %d : id=%d, command=%d, s1=%s, s2=%s<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span>
		   ret<span style="color: #339933;">,</span> id<span style="color: #339933;">,</span> command<span style="color: #339933;">,</span> string1<span style="color: #339933;">,</span> string2<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>ret<span style="color: #339933;">==-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #b1b100;">switch</span><span style="color: #009900;">&#40;</span>command<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">case</span> SERVERDATA_AUTH_RESPONSE<span style="color: #339933;">:</span>
    <span style="color: #b1b100;">switch</span><span style="color: #009900;">&#40;</span>id<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">case</span> <span style="color: #0000dd;">20</span><span style="color: #339933;">:</span> 
      auth <span style="color: #339933;">=</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
      <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">case</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #339933;">:</span>
      <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Password Refused<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">return</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">default</span><span style="color: #339933;">:</span>
      <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Bad Auth Response ID = %d<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span>id<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000066;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">case</span> SERVERDATA_RESPONSE_VALUE<span style="color: #339933;">:</span>
    <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%s&quot;</span><span style="color: #339933;">,</span>string1<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">default</span><span style="color: #339933;">:</span>
    <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Unexpected command: %d&quot;</span><span style="color: #339933;">,</span>command<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #993333;">int</span> main<span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> argc<span style="color: #339933;">,</span> <span style="color: #993333;">char</span> <span style="color: #339933;">**</span>argv<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #993333;">struct</span> sockaddr_in a<span style="color: #339933;">;</span>
  <span style="color: #993333;">int</span> sock<span style="color: #339933;">;</span>
  <span style="color: #993333;">int</span> ret<span style="color: #339933;">,</span> i<span style="color: #339933;">;</span>
  <span style="color: #993333;">char</span> password<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">512</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #ff0000;">&quot;YOUR_PASSWORD_HERE&quot;</span><span style="color: #339933;">;</span>
  <span style="color: #993333;">short</span> port <span style="color: #339933;">=</span> <span style="color: #0000dd;">27015</span><span style="color: #339933;">;</span>
  <span style="color: #993333;">char</span> address<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">512</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;127.0.0.1&quot;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #993333;">int</span> arg<span style="color: #339933;">;</span>
&nbsp;
  auth <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>argc<span style="color: #339933;">&lt;</span><span style="color: #0000dd;">2</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Syntax: rcon [-P<span style="color: #000099; font-weight: bold;">\&quot;</span>rcon_password<span style="color: #000099; font-weight: bold;">\&quot;</span>] [-a127.0.0.1] [-p27015] command<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span>arg <span style="color: #339933;">=</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>arg<span style="color: #339933;">&lt;</span>argc<span style="color: #339933;">;</span>arg<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>argv<span style="color: #009900;">&#91;</span>arg<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">!=</span> <span style="color: #ff0000;">'-'</span><span style="color: #009900;">&#41;</span>
      <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span> <span style="color: #808080; font-style: italic;">/* done with args */</span>
    <span style="color: #b1b100;">switch</span><span style="color: #009900;">&#40;</span>argv<span style="color: #009900;">&#91;</span>arg<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">case</span> <span style="color: #ff0000;">'a'</span><span style="color: #339933;">:</span>
      <span style="color: #000066;">strncpy</span><span style="color: #009900;">&#40;</span>address<span style="color: #339933;">,</span> argv<span style="color: #009900;">&#91;</span>arg<span style="color: #009900;">&#93;</span><span style="color: #339933;">+</span><span style="color: #0000dd;">2</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">512</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">case</span> <span style="color: #ff0000;">'p'</span><span style="color: #339933;">:</span>
      port <span style="color: #339933;">=</span> <span style="color: #000066;">atoi</span><span style="color: #009900;">&#40;</span>argv<span style="color: #009900;">&#91;</span>arg<span style="color: #009900;">&#93;</span><span style="color: #339933;">+</span><span style="color: #0000dd;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">case</span> <span style="color: #ff0000;">'P'</span><span style="color: #339933;">:</span>
      <span style="color: #000066;">strncpy</span><span style="color: #009900;">&#40;</span>password<span style="color: #339933;">,</span> argv<span style="color: #009900;">&#91;</span>arg<span style="color: #009900;">&#93;</span><span style="color: #339933;">+</span><span style="color: #0000dd;">2</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">512</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">default</span><span style="color: #339933;">:</span>
      <span style="color: #000066;">fprintf</span><span style="color: #009900;">&#40;</span>stderr<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Unknown option -%c<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span>argv<span style="color: #009900;">&#91;</span>arg<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  a.<span style="color: #202020;">sin_family</span> <span style="color: #339933;">=</span> AF_INET<span style="color: #339933;">;</span>
  a.<span style="color: #202020;">sin_addr</span>.<span style="color: #202020;">s_addr</span> <span style="color: #339933;">=</span> inet_addr<span style="color: #009900;">&#40;</span>address<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  a.<span style="color: #202020;">sin_port</span> <span style="color: #339933;">=</span> htons<span style="color: #009900;">&#40;</span>port<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  sock <span style="color: #339933;">=</span> socket<span style="color: #009900;">&#40;</span>AF_INET<span style="color: #339933;">,</span> SOCK_STREAM<span style="color: #339933;">,</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// TCP socket</span>
&nbsp;
  ret <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
  ret <span style="color: #339933;">=</span> connect<span style="color: #009900;">&#40;</span>sock<span style="color: #339933;">,</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">struct</span> sockaddr <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&amp;</span>a<span style="color: #339933;">,</span><span style="color: #993333;">sizeof</span><span style="color: #009900;">&#40;</span>a<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>ret <span style="color: #339933;">==</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066;">perror</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;connect() failed.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>DEBUG<span style="color: #009900;">&#41;</span> <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Connected to Server<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>DEBUG<span style="color: #009900;">&#41;</span> <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Sending RCON Password<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  ret<span style="color: #339933;">=</span>send_rcon<span style="color: #009900;">&#40;</span>sock<span style="color: #339933;">,</span> <span style="color: #0000dd;">20</span><span style="color: #339933;">,</span> SERVERDATA_AUTH<span style="color: #339933;">,</span> password<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>ret <span style="color: #339933;">==</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066;">perror</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Sending password&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span>auth<span style="color: #339933;">==</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>process_response<span style="color: #009900;">&#40;</span>sock<span style="color: #009900;">&#41;</span><span style="color: #339933;">==-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Couldn't Authenticate<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000066;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>DEBUG<span style="color: #009900;">&#41;</span> <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Password Accepted<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #808080; font-style: italic;">/* Now we're authorized, send command */</span>
&nbsp;
  <span style="color: #808080; font-style: italic;">/* built command */</span>
  ret <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span>arg <span style="color: #339933;">&lt;</span> argc<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000066;">strlen</span><span style="color: #009900;">&#40;</span>argv<span style="color: #009900;">&#91;</span>arg<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> ret <span style="color: #339933;">&lt;</span> <span style="color: #0000dd;">4096</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000066;">strcpy</span><span style="color: #009900;">&#40;</span>string1<span style="color: #339933;">+</span>ret<span style="color: #339933;">,</span> argv<span style="color: #009900;">&#91;</span>arg<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      ret <span style="color: #339933;">+=</span> <span style="color: #000066;">strlen</span><span style="color: #009900;">&#40;</span>argv<span style="color: #009900;">&#91;</span>arg<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      string1<span style="color: #009900;">&#91;</span>ret<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">' '</span><span style="color: #339933;">;</span>
      ret<span style="color: #339933;">++;</span>
      arg<span style="color: #339933;">++;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000066;">fprintf</span><span style="color: #009900;">&#40;</span>stderr<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;cmd too long to send<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">return</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #666666; font-style: italic;">//  string1[ret] = '\n';</span>
  <span style="color: #666666; font-style: italic;">//ret++;</span>
  ret<span style="color: #339933;">--;</span>
  string1<span style="color: #009900;">&#91;</span>ret<span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>DEBUG<span style="color: #009900;">&#41;</span> <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Sending Command: <span style="color: #000099; font-weight: bold;">\&quot;</span>%s<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> string1<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  ret<span style="color: #339933;">=</span>send_rcon<span style="color: #009900;">&#40;</span>sock<span style="color: #339933;">,</span> <span style="color: #0000dd;">20</span><span style="color: #339933;">,</span> SERVERDATA_EXECCOMMAND<span style="color: #339933;">,</span> string1<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>ret <span style="color: #339933;">==</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066;">perror</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;cmd send&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// process responses until a timeout</span>
  <span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span>process_response<span style="color: #009900;">&#40;</span>sock<span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.dopefish.de/archives/1052/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to build an efficient GeoIP SQL table</title>
		<link>http://www.dopefish.de/archives/1037</link>
		<comments>http://www.dopefish.de/archives/1037#comments</comments>
		<pubDate>Mon, 22 Aug 2011 19:17:48 +0000</pubDate>
		<dc:creator>dopefish</dc:creator>
				<category><![CDATA[Internet Stuff]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[GeoIP]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.dopefish.de/?p=1037</guid>
		<description><![CDATA[This here is a very handy little script I threw together to generate a geoip.sql table for quickly determining which country a IP is from. I already hear you saying &#8220;Just convert the IP to an INT and use BETWEEN, how hard can it be&#8221;. And you are right, that works. And it may even [...]]]></description>
			<content:encoded><![CDATA[<p>This here is a very handy little script I threw together to generate a geoip.sql table for quickly determining which country a IP is from. I already hear you saying &#8220;Just convert the IP to an INT and use BETWEEN, how hard can it be&#8221;. And you are right, that works. And it may even be your easiest solution, but it just isn&#8217;t fast. And if you are planning on hammering the table with thousands of queries you are going to end up looking for something fast.</p>
<p>A while back I found a very interesting posting at www.<a href="http://jcole.us/blog/archives/2007/11/24/on-efficiently-geo-referencing-ips-with-maxmind-geoip-and-mysql-gis/" target="_blank">jcole.us</a>&nbsp;that described how to use <a href="http://dev.mysql.com/doc/refman/5.0/en/creating-spatial-indexes.html" target="_blank">Spacial Indexes</a>&nbsp;together with <a href="http://dev.mysql.com/doc/refman/5.0/en/spatial-extensions.html" target="_blank">MySQL&#8217;s GIS</a> to speed up the queries. The posting has been online for a while and both it and the replies are worth reading.</p>
<p>All I did was make a small bash script to download the current &#8220;lite&#8221; version of GeoIP CSV file from maxmind.com, use the information from the posting to throw/transform it into a local database table and dump out a .sql file that can be easily imported into any other database. The script isn&#8217;t failproof though, it expects your user to be able to use mysql and have permission to create databases/tables and &#8220;load data local infile&#8221;.</p>
<p><strong><a href="http://dopefish.de/bash/generate_geoip_sql.sh" target="_blank">generate_geoip_sql.sh</a></strong></p>

<div class="my_syntax_box"><span class="my_syntax_selecall"><a href="javascript:;" onclick="selectCode(this); return false;">Select All</a> </span><span class="my_syntax_Bar">Code:</span><div class="my_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #666666; font-style: italic;">#===============================================================================</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#          FILE: generate_geoip_sql.sh</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#         USAGE: ./generate_geoip_sql.sh</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#   DESCRIPTION: Generates a optimized sql dump with geoipdata from maxmind.com</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#         USAGE: import sql into a database</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#  REQUIREMENTS: mysql database rights to create databases and LOAD DATA LOCAL INFILE</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#       EXAMPLE:</span>
<span style="color: #666666; font-style: italic;">#                 SELECT country_code,country_name</span>
<span style="color: #666666; font-style: italic;">#                 FROM   geo_ip</span>
<span style="color: #666666; font-style: italic;">#                 WHERE  MBRCONTAINS(ip_poly, POINTFROMWKB(POINT(INET_ATON('1.2.3.4'), 0)))</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#                 SELECT country_code,country_name</span>
<span style="color: #666666; font-style: italic;">#                 FROM   geo_ip</span>
<span style="color: #666666; font-style: italic;">#                 WHERE  INET_ATON('1.2.3.4') </span>
<span style="color: #666666; font-style: italic;">#                 BETWEEN ip_from AND ip_to;</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#        AUTHOR:  Ryan Schulze (rs), ryan@dopefish.de</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#===============================================================================</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">set</span> <span style="color: #660033;">-o</span> nounset                              <span style="color: #666666; font-style: italic;"># Treat unset variables as an error</span>
&nbsp;
<span style="color: #007800;">CSVFile</span>=<span style="color: #ff0000;">&quot;GeoIPCountryWhois.csv&quot;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-e</span> <span style="color: #800000;">${CSVFile}</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>
  <span style="color: #000000; font-weight: bold;">then</span>
  <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-en</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #007800;">${CSVFile}</span> already exists, download a newer version? [Y/n]: &quot;</span>
  <span style="color: #c20cb9; font-weight: bold;">read</span> answer
  <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$(echo $answer|tr &quot;N&quot; &quot;n&quot;)</span>&quot;</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;n&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>
  <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #800000;">${CSVFile}</span>
  <span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-e</span> <span style="color: #800000;">${CSVFile}</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">then</span>
  <span style="color: #007800;">tmpfile</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">mktemp</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
  <span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #660033;">-O</span> <span style="color: #800000;">${tmpfile}</span> http:<span style="color: #000000; font-weight: bold;">//</span>geolite.maxmind.com<span style="color: #000000; font-weight: bold;">/</span>download<span style="color: #000000; font-weight: bold;">/</span>geoip<span style="color: #000000; font-weight: bold;">/</span>database<span style="color: #000000; font-weight: bold;">/</span>GeoIPCountryCSV.zip
  <span style="color: #c20cb9; font-weight: bold;">unzip</span> <span style="color: #800000;">${tmpfile}</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #800000;">${tmpfile}</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>generating geoip.sql&quot;</span>
&nbsp;
mysql <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;create database if not exists temp&quot;</span>
mysql <span style="color: #660033;">-D</span> temp <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;drop table if exists geo_ip&quot;</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'
CREATE TABLE geo_ip
(
  id           INT UNSIGNED  NOT NULL auto_increment,
  ip_poly      POLYGON       NOT NULL,
  ip_from      INT UNSIGNED  NOT NULL,
  ip_to        INT UNSIGNED  NOT NULL,
  country_code CHAR(2)       NOT NULL,
  country_name CHAR(50)      NOT NULL,
  PRIMARY KEY (id),
  SPATIAL INDEX (ip_poly)
);
LOAD DATA LOCAL INFILE &quot;GeoIPCountryWhois.csv&quot;
INTO TABLE geo_ip
FIELDS
  TERMINATED BY &quot;,&quot;
  ENCLOSED BY &quot;\&quot;&quot;
LINES
  TERMINATED BY &quot;\n&quot;
(
  @ip_from_string, @ip_to_string,
  @ip_from, @ip_to,
  @country_code, @country_string
)
SET
  id      := NULL,
  ip_from := @ip_from,
  ip_to   := @ip_to,
  ip_poly := GEOMFROMWKB(POLYGON(LINESTRING(
    /* clockwise, 4 points and back to 0 */
    POINT(@ip_from, -1), /* 0, top left */
    POINT(@ip_to,   -1), /* 1, top right */
    POINT(@ip_to,    1), /* 2, bottom right */
    POINT(@ip_from,  1), /* 3, bottom left */
    POINT(@ip_from, -1)  /* 0, back to start */
  ))),
  country_code := @country_code,
  country_name := @country_string
;
'</span> <span style="color: #000000; font-weight: bold;">|</span> mysql <span style="color: #660033;">-D</span> temp
&nbsp;
mysqldump <span style="color: #660033;">--opt</span> temp geo_ip <span style="color: #000000; font-weight: bold;">&gt;</span> geoip.sql
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>done generating geoip.sql&quot;</span></pre></td></tr></table></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.dopefish.de/archives/1037/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>win7 system restore &#8230; aaarrrrgggh</title>
		<link>http://www.dopefish.de/archives/1032</link>
		<comments>http://www.dopefish.de/archives/1032#comments</comments>
		<pubDate>Thu, 28 Jul 2011 22:49:40 +0000</pubDate>
		<dc:creator>dopefish</dc:creator>
				<category><![CDATA[Me]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[junctions]]></category>
		<category><![CDATA[system restore]]></category>
		<category><![CDATA[user directory]]></category>
		<category><![CDATA[win7]]></category>

		<guid isPermaLink="false">http://www.dopefish.de/?p=1032</guid>
		<description><![CDATA[Warning: this is mainly me just ranting about Microsoft stupidity and a warning for anyone using junctions.
About a month or two ago I built myself a new PC (old one was dying) and installed Win7 on it.  Since I was previously still on WinXP there were a few things to get used to, but all [...]]]></description>
			<content:encoded><![CDATA[<p>Warning: this is mainly me just ranting about Microsoft stupidity and a warning for anyone using junctions.</p>
<p>About a month or two ago I built myself a new PC (old one was dying) and installed Win7 on it.  Since I was previously still on WinXP there were a few things to get used to, but all in all I enjoyed the update. There were of course some strange Windows pitfalls involved, moving your users directory to a different drive really isn&#8217;t straightforward, but works if you use junctions to link the directories.</p>
<p>Since Virtualbox drops the guests in a subfolder of the users directory I decided to move my users directory to one of the larger mechanical disks in my system, to keep the windows drive (a SSD disk) with plenty of space.</p>
<p>Now fast forward to yesterday, where some software I installed decided to clear out most of my Start-&gt;All Programs folder, leaving me with lots of installed softawre, and no Start Menu links. After trying some stuff out I finally caved in and used System Restore to get my Start Menu working again. System Restore actually worked fine, I got my Start Menu back &#8230; unfortunately it also corrupted my profile, and while googling to find out how to fix it I found a whole lot of people with the same problem.</p>
<p>Junction + User directory + System Restore = corrupt user, non repairable. Hello Microsoft, this is all original system software, no 3rd party stuff, breaking my user is totally uncool.</p>
<p>So after trying all kinds of crazy tips I found I gave up and followed the <a href="http://windows.microsoft.com/en-us/windows7/Fix-a-corrupted-user-profile" target="_blank">official instructions</a> (a.k.a. You are fucked, haha bye bye user registry). And right now I am copying stuff from my old profile to my new one and setting up all the software that had stored stuff in the registry. This time my Profile stays on C: without any junctions, it&#8217;s easier to repair Virtualbox if it breaks over the images being in a non-standard path than worrying about windows corrupting my whole profile if I touch System Restore.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dopefish.de/archives/1032/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to add file versions/history to iFolder</title>
		<link>http://www.dopefish.de/archives/1025</link>
		<comments>http://www.dopefish.de/archives/1025#comments</comments>
		<pubDate>Thu, 21 Jul 2011 03:34:19 +0000</pubDate>
		<dc:creator>dopefish</dc:creator>
				<category><![CDATA[Internet Stuff]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[files]]></category>
		<category><![CDATA[history]]></category>
		<category><![CDATA[iFolder]]></category>
		<category><![CDATA[sync]]></category>

		<guid isPermaLink="false">http://www.dopefish.de/?p=1025</guid>
		<description><![CDATA[I&#8217;ve been using iFolder for about a month now and am pretty satisfied with the performance and features, but there is one feature I dearly miss: having access to older versions of a file.  To work around this problem I simply created a SVN repository for every iFolder user.  This allows the users to &#8220;check in&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using <a title="iFolder" href="http://www.kablink.org/ifolder" target="_blank">iFolder</a> for about a month now and am pretty satisfied with the performance and features, but there is one feature I dearly miss: having access to older versions of a file.  To work around this problem I simply created a <a title="Subversion" href="http://subversion.apache.org/" target="_blank">SVN</a> <a title="SVN epository" href="http://svnbook.red-bean.com/en/1.5/svn.basic.repository.html" target="_blank">repository</a> for every iFolder user.  This allows the users to &#8220;check in&#8221; files whenever they want to save a specific version of a file, they can tell SVN to ignore directories that they don&#8217;t need or want in the SVN system. And you can easily browse through the history of a file, pulling up versions from specific dates, or seeing what changed when in the file (obviously not for binary data).</p>
<p>I am fully aware that SVN may be a bit overkill and that I am only using a very small subset of the SVN features, but on the other hand it is very easy to set up, and there are clients for all the major OS out there that integrate seamlessly into the file managers. So even if I don&#8217;t need all the bells and whistles it does what I need it to do without any worries.</p>
<p>As with all workarounds this of course brings some limitations and implications with it.
<ul>
<li>First of all you will only have the history of a file on systems with a svn client, so no history if you are accessing the files via webinterface.</li>
<li>Situations where multiple people have access to the same files must be set up in the same consellation in SVN to ensure all users have access to file histories</li>
<li>Due to the usage of two systems (iFolder and SVN) the files will be stored in both systems</li>
</ul>
<div>Depending on your setup and needs the implications may turn out to be a dealbreaker. But if not it may be a viable &#8220;addon&#8221; to add some features you otherwise missed. I&#8217;m not going to go into &#8220;how to setup SVN&#8221;, since anything I write would be tuned to a specific installation. Just use google, there are plenty of Howtos out there, just find the one that meets your system.</div>
]]></content:encoded>
			<wfw:commentRss>http://www.dopefish.de/archives/1025/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to install ruby 1.9.2 on Ubuntu 10.04</title>
		<link>http://www.dopefish.de/archives/1018</link>
		<comments>http://www.dopefish.de/archives/1018#comments</comments>
		<pubDate>Thu, 07 Jul 2011 18:49:52 +0000</pubDate>
		<dc:creator>dopefish</dc:creator>
				<category><![CDATA[Internet Stuff]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[LTS]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[Ubuuntu]]></category>

		<guid isPermaLink="false">http://www.dopefish.de/?p=1018</guid>
		<description><![CDATA[The current LTS version of Ubuntu is 10.04 and the most current version of ruby it ships with is 1.9.1. Unfurtunately 1.9.1 wasn&#8217;t that great of a release and anyone using the 1.9 branch really should use the stable 1.9.2.
After doing a bit of researching I found some information on how the best approach to [...]]]></description>
			<content:encoded><![CDATA[<p>The current <a title="Ubuntu LTS" href="https://wiki.ubuntu.com/LTS" target="_blank">LTS</a> version of Ubuntu is 10.04 and the most current version of ruby it ships with is 1.9.1. Unfurtunately 1.9.1 wasn&#8217;t that great of a release and anyone using the 1.9 branch really should use the stable 1.9.2.</p>
<p>After doing a bit of researching I found some information on how the best approach to get ruby installed is. Downloading the source, compiling it and registering the installed version with the package manager.</p>
<p>The following little bash script takes care of installing ruby 1.9.2 on a ubuntu or debian based system (or any other version if you change the $Version variable in the script). The script just consolidates information found online and wraps it up into a nice bashscript</p>

<div class="my_syntax_box"><span class="my_syntax_selecall"><a href="javascript:;" onclick="selectCode(this); return false;">Select All</a> </span><span class="my_syntax_Bar">Code:</span><div class="my_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #666666; font-style: italic;">#===============================================================================</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#          FILE:  install_ruby_1.9.sh</span>
<span style="color: #666666; font-style: italic;"># </span>
<span style="color: #666666; font-style: italic;">#         USAGE:  ./install_ruby_1.9.sh </span>
<span style="color: #666666; font-style: italic;"># </span>
<span style="color: #666666; font-style: italic;">#        AUTHOR: Ryan Schulze (rs), ryan@dopefish.de</span>
<span style="color: #666666; font-style: italic;">#       CREATED: 07/07/2011 11:59:37 AM CDT</span>
<span style="color: #666666; font-style: italic;">#===============================================================================</span>
&nbsp;
<span style="color: #007800;">Version</span>=<span style="color: #ff0000;">&quot;1.9.2-p180&quot;</span>
<span style="color: #007800;">GZFile</span>=<span style="color: #ff0000;">&quot;ruby-<span style="color: #007800;">${Version}</span>.tar.gz&quot;</span>
<span style="color: #007800;">Download</span>=<span style="color: #ff0000;">&quot;http://ftp.ruby-lang.org/pub/ruby/1.9/<span style="color: #007800;">${GZFile}</span>&quot;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$(id -u)</span>&quot;</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;You need root permission to execute this script&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">exit</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #660033;">-q</span> update
<span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #660033;">-qy</span> upgrade
<span style="color: #c20cb9; font-weight: bold;">apt-get install</span> <span style="color: #660033;">-qy</span> build-essential <span style="color: #c20cb9; font-weight: bold;">wget</span> zlib1g-dev libssl-dev libffi-dev <span style="color: #c20cb9; font-weight: bold;">autoconf</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #7a0874; font-weight: bold;">test</span> <span style="color: #660033;">-e</span> <span style="color: #800000;">${GZFile}</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #800000;">${Download}</span>
<span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-xzf</span> <span style="color: #800000;">${GZFile}</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> ruby-<span style="color: #800000;">${Version}</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">autoconf</span>
.<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--with-ruby-version</span>=<span style="color: #800000;">${Version}</span> <span style="color: #660033;">--prefix</span>=<span style="color: #000000; font-weight: bold;">/</span>usr <span style="color: #660033;">--program-suffix</span>=<span style="color: #800000;">${Version}</span> 
<span style="color: #c20cb9; font-weight: bold;">make</span>
<span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>ruby<span style="color: #000000; font-weight: bold;">/</span>gems<span style="color: #000000; font-weight: bold;">/</span><span style="color: #800000;">${Version}</span><span style="color: #000000; font-weight: bold;">/</span>bin
&nbsp;
update-alternatives \
	<span style="color: #660033;">--install</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ruby ruby <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ruby<span style="color: #800000;">${Version}</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #800000;">${Version//./}</span><span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">cut</span> <span style="color: #660033;">-d-</span> -f1<span style="color: #7a0874; font-weight: bold;">&#41;</span> \
	<span style="color: #660033;">--slave</span>   <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>man<span style="color: #000000; font-weight: bold;">/</span>man1<span style="color: #000000; font-weight: bold;">/</span>ruby.1.gz ruby.1.gz <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>man<span style="color: #000000; font-weight: bold;">/</span>man1<span style="color: #000000; font-weight: bold;">/</span>ruby<span style="color: #800000;">${Version}</span>.1 \
	<span style="color: #660033;">--slave</span>   <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>ruby<span style="color: #000000; font-weight: bold;">/</span>gems<span style="color: #000000; font-weight: bold;">/</span>bin        gem-bin   <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>ruby<span style="color: #000000; font-weight: bold;">/</span>gems<span style="color: #000000; font-weight: bold;">/</span><span style="color: #800000;">${Version}</span><span style="color: #000000; font-weight: bold;">/</span>bin \
	<span style="color: #660033;">--slave</span>   <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>erb  erb  <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>erb<span style="color: #800000;">${Version}</span> \
	<span style="color: #660033;">--slave</span>   <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>irb  irb  <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>irb<span style="color: #800000;">${Version}</span> \
	<span style="color: #660033;">--slave</span>   <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>rdoc rdoc <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>rdoc<span style="color: #800000;">${Version}</span> \
	<span style="color: #660033;">--slave</span>   <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ri   ri   <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ri<span style="color: #800000;">${Version}</span> \
	<span style="color: #660033;">--slave</span>   <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>gem  gem  <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>gem<span style="color: #800000;">${Version}</span> \
&nbsp;
update-alternatives <span style="color: #660033;">--config</span> ruby
update-alternatives <span style="color: #660033;">--display</span> gem <span style="color: #000000; font-weight: bold;">&gt;/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">1</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> update-alternatives <span style="color: #660033;">--remove-all</span> gem
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;[+] Done installing&quot;</span>
ruby <span style="color: #660033;">-v</span></pre></div></div></div>

<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dopefish.de/archives/1018/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Using iFolder as an open source Dropbox alternative</title>
		<link>http://www.dopefish.de/archives/1012</link>
		<comments>http://www.dopefish.de/archives/1012#comments</comments>
		<pubDate>Sat, 25 Jun 2011 20:51:09 +0000</pubDate>
		<dc:creator>dopefish</dc:creator>
				<category><![CDATA[Internet Stuff]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[Dropbox]]></category>
		<category><![CDATA[files]]></category>
		<category><![CDATA[iFolder]]></category>
		<category><![CDATA[sync]]></category>

		<guid isPermaLink="false">http://www.dopefish.de/?p=1012</guid>
		<description><![CDATA[I&#8217;ve had a few posting here in my blog over the years about trying to keep data synced over various computers. Nowadays it has gotten easier since it seems everyone is chruning out their own online storage. Classics like Dropbox or SugarSync, and then we have the big companies  Google, Microsoft and Ubuntu trying their [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve had a few posting here in my blog over the years about trying to keep data synced over various computers. Nowadays it has gotten easier since it seems everyone is chruning out their own online storage. Classics like Dropbox or SugarSync, and then we have the big companies  Google, Microsoft and Ubuntu trying their luck. Basically they all provide you with 2-5Gb free storage, and more space and features for more money. But they all have one downside, whether encrypted or not, you are leaving your own files to the mercy of an external company. There is not really any voodoo in the whole system, basically you just have some space online, a bit of encryption, and some way to ensure that all clients of a user are synced, nonetheless building your own service can be a hassle as I have found out.</p>
<p>Currently I&#8217;m using SVN as a workaround. I just sometimes forget to commit, which leads to me having old data and no access to updated files. Instead of starting from scratch and build strange stuff with rsync I had a look if there were any open source solutions out there. And I was pleased to find a few. Unfortunately they are almost all in the &#8220;I have an idea and a few mockups&#8221; stage, maybe even some beta version that does something, but nothing really &#8220;production&#8221; level. Another downside was that most of them either supported Linux or Windows, but often not both.</p>
<p>One open source solution I stumbled across is <a title="iFolder" href="http://www.kablink.org/ifolder/features" target="_blank">iFolder</a>,  seasoned software supported by Novell, with clients for Windows, Linux and Mac. And if all else fails you can use the web interface to access your files. Admin and User web interface are both easy to use. I don&#8217;t remember how I stumbled across it, but I do know that it&#8217;s not one of the main products you see named when searching for alternatives to Dropbox.</p>
<p>If you have SuSE as an OS, then installing the software is immensely simplified due to SuSE belonging to Novell, just follow the <a title="Suse Install" href="http://www.kablink.org/ifolder/get_started" target="_blank">SuSE instructions</a> on the website. I prefer debian based installations and found <a href="https://help.ubuntu.com/community/iFolderInstall" target="_blank">Ubuntu instructions</a> at help.ubuntu.com that were written mainly for Ubuntu, but should work with any debian deviate.</p>
<p>I&#8217;m not going to repeat anything from the installation instructions, they already did a fine job of documenting everything. One thing is important however: the Client 3.8.0.0 just plain doesn&#8217;t work. unfortunately it is the one linked from the website. Go to the sourceforge repository, and download the newer 3.8.03 client. That one works like a charm.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dopefish.de/archives/1012/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

<!-- Served from: www.dopefish.de @ 2012-02-05 17:14:30 by W3 Total Cache -->
