This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Analyzes filetree and gives statistics of file created by extension and year | |
FILEPATH="/var/www/" | |
TMPFILEFROM=/tmp/datefrom.tmp | |
TMPFILETO=/tmp/dateto.tmp | |
echo "all files" | |
for YEAR in {2013..2005} | |
do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DB_TABLE=pages | |
DB_CRITERIAL_FIELD=tstamp | |
YEAR=2005 | |
DB_QUERY="select count(uid) from $DB_TABLE where FROM_UNIXTIME($DB_CRITERIAL_FIELD) >= '$YEAR-01-01 00:00:00' and FROM_UNIXTIME($DB_CRITERIAL_FIELD) <= '$YEAR-12-31 23:59:00';" | |
echo $DB_QUERY | |
for i in {2013..2005} | |
do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
find /var/www/ -type f -iname "*.*" | awk -F. '{print $NF}' | tr '[:upper:]' '[:lower:]' | sort -u | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# ref. : man find | |
# printf options | |
# %p Files name. | |
# %P Files name with the name of the command line argument under which it was found removed. | |
# %s Files size in bytes. | |
# %Ak Files last access time in the format specified by k | |
# %Ck Files last status change time | |
# %Tk Files last modification time | |
# Time options k |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# ref. : man find | |
# printf options | |
# %p Files name. | |
# %P Files name with the name of the command line argument under which it was found removed. | |
# %s Files size in bytes. | |
# %Ak Files last access time in the format specified by k | |
# %Ck Files last status change time | |
# %Tk Files last modification time | |
# Time options k |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ref. : http://dev.mysql.com/doc/refman/5.1/en/load-data.html | |
LOAD DATA INFILE 'filename.txt' | |
INTO TABLE databasename.tablename | |
FIELDS TERMINATED BY '\t' ENCLOSED BY '"' | |
LINES TERMINATED BY '\n' | |
IGNORE 1 LINES; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ssh_master=$1 | |
ssh_upstream=$2 | |
git clone $ssh_master | |
git remote add upstream $ssh_upstream | |
git fetch upstream | |
git merge upstream/master | |
git push origin master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Casper script to restart Alwaysdata processes. | |
* | |
* Usage: | |
* $ casperjs kill.js email@example.com mysecretpassword | |
*/ | |
var casper = require('casper').create(); | |
casper.start("https://admin.alwaysdata.com/login/"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var casper = require('casper').create({logLevel: 'debug', verbose: false}), | |
schedules = []; | |
casper.start('http://conf2013.web-5.org/en/conference-schedule/', function() { | |
schedules = this.evaluate(function() { | |
var schedules = document.querySelectorAll('.schedule .track > ul > li'), | |
tag, obj, content; | |
return Array.prototype.map.call(schedules, function(e) { | |
obj = { | |
day: e.querySelector('time').getAttribute('datetime').split(' ')[0], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ln -sf `pwd`/bin/casperjs /usr/local/bin/casperjs |