posted this in FreeBSD, Linux on March 10th, 2013 Here’s a quick note on how to download the contents of an http directory via command line.
Using lftp to download an HTTP directory
Forget wget, lftp is what you covet!
What is lftp?
LFTP is a sophisticated ftp/http client, and a file transfer program supporting a number of network protocols. Like BASH, it has . . . → Read More: download http directory
posted this in C on March 1st, 2013 Recently I was trying to compile connectsock.c from Internetworking With TCP/IP Volume III: Client-Server Programming and Applications, Linux/POSIX Socket Version (with D. Stevens), 2000. 0-13-032071-4
Compile Error
|
|
connectsock.c: In function connectsock: connectsock.c:52:28: error: struct hostent has no member named h_addr |
Solution? Modify the Make file!
Before:
|
|
DEFS = CFLAGS = -W -pedantic -ansi -g ${DEFS} ${INCLUDE} |
After:
|
|
DEFS = CFLAGS =-W-pedantic-ansi-g $ {DEFS} $ {INCLUDE}-D_GNU_SOURCE |
posted this in Windows on February 3rd, 2013 The easiest way to get curl on windows with HTTPS is to simply download and install the git package then add
|
|
c:\Program Files (x86)\Git\bin |
as an environment variable to allow you to run curl from anywhere.
Don’t forget when running curl commands in a DOS prompt to use double quotes.
Example:
|
|
curl https://www.cloudflare.com/api_json.html -d "a=fpurge_ts" -d "tkn=<apikey>" -d "email=<username>" -d "z=domain" -d "v=1" {"response":{"fpurge_ts":1359831767},"result":"success","msg":null,"attributes":{"cooldown":20}}</username></apikey> |
posted this in nginx, Redhat Centos, Server Setup, Ubuntu on January 30th, 2013 Objective
Remove the index.php prefix from your nginx code igniter instance.
Assumptions In your main nginx conf file you define how php is called (unix socket or ip:port) You will replace foo.example.com with whatever your domain name is The proper logging path will be defined per your system as opposed to the location i have . . . → Read More: nginx code igniter remove index.php prefix
Recently I tried passing a bash variable to perl command in bash script, it didn’t end well.
Troy Engel from http://tacticalvim.wordpress.com/ was nice enough to point out the issue:
use sed instead of perl for what you need; it’s simpler, faster and uses the bash variables easily.
I set up a test script /home/someuser/test.sh to show:
. . . → Read More: passing bash variable to perl command in bash script
posted this in Linux, Redhat Centos, Ubuntu on January 17th, 2013
Objective: Append multiline text with cat Examples Tell log rotate to start rotating the http log (this overwrites any existing file)
append text to end of file with cat
Q: What is this magical feature? A: Here Documents . . . → Read More: append text to end of file with cat
posted this in Linux, Redhat Centos on January 11th, 2013 To install geoip php centos follow these steps
Install Steps
|
|
# cd /tmp # wget http://pecl.php.net/get/geoip-1.0.8.tgz # tar -zxvf geoip-1.0.8.tgz # cd geoip-1.0.8.tgz # phpize # ./configure # make # make install # echo "extension=geoip.so" >> /etc/php.d/geo.ini |
Verify Installation
|
|
# php -r 'print_r(phpinfo());' | grep -i geoip geoip geoip support => enabled geoip extension version => 1.0.8 geoip library version => 1004005 geoip.custom_directory => no value => no value OLDPWD => /tmp/geoip-1.0.6 _SERVER["OLDPWD"] => /tmp/geoip-1.0.6 # |
posted this in Uncategorized on January 11th, 2013 git copy remote branch
Copy remote master branch to remote QA branch in git
|
|
git push origin --delete QA git push origin master:QA |
Copy remote master branch to remote production branch in git
|
|
git push origin --delete production git push origin master:production |
posted this in Software on December 19th, 2012 Problem
You are getting this error message when starting Adobe Acrobat X
|
|
acrobat failed to connect to a DDE server |
Soultion
Modify this registry Key:
|
|
HKEY_CLASSES_ROOT\acrobat\shell\open\ddeexec\application |
Change value “AcroViewA10″ to “AcroViewR10″
posted this in Admin, MYSQL, php, Wordpress on December 4th, 2012 Goal: Update wordpress post with PHP cli
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
< ?php $con = mysql_connect("localhost","root","[redacted]"); if (!$con) { echo "Unable to connect to DB: " . mysql_error(); exit; } if (!mysql_select_db("wordpress")) { echo "Unable to select mydbname: " . mysql_error(); exit; } $myfileText = mysql_real_escape_string(file_get_contents('./code_for_wordpress.html',true)); $sql = "UPDATE `[your_instance_prefix]_posts` SET `post_content` = '$myfileText' WHERE `ID` like '1397';"; $result = mysql_query($sql); if (!$result) { echo "Could not successfully run query ($sql) from DB: " . mysql_error(); exit; } mysql_close($con); ?> |
|
|