Skip to content

Instantly share code, notes, and snippets.

@echo off
call :treeProcess
goto :eof
:treeProcess
rem Do whatever you want here over the files of this subdir, for example:
for %%f in (*.pdf) do call :copyAdditive "%%f"
for /D %%d in (*) do (
cd %%d
call :treeProcess
#!/bin/bash
#sshpass -p "qwerty" scp -r user@example.com:/some/remote/path /some/local/path
COUNTER=0
while [ $COUNTER -lt 10 ]; do
folderName=$(date)
echo $(date)
mkdir "$(date)"
cd "$(date)"
sshpass -p PASSWD scp USER@10.0.26.18:/var/log/* .
cd ..

tmux cheatsheet

As configured in my dotfiles.

start new with session name:

tmux new -s myname

attach to named:

tmux a -t myname

@avilshadow
avilshadow / mongodb.md
Last active August 29, 2015 14:01
mongo commands

mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]

:mongodump --host [ip] --db [db_name] --port 27017 --out dbName.dump mongodump --host=[ip]:27017 --out=/media/backup/2014-06-06_11h00m --oplog

:mongorestore --db [ToDatabaseName] dumpDirectory.dump/ mongorestore --oplogReplay

if restore error do: export LC_ALL="en_US.UTF-8"

@avilshadow
avilshadow / gist:87bff7ea88edad1272a7
Created June 2, 2014 09:07
hints with linux services
service --status-all | grep ntpd
or ls /etc/init.d/
//special for mac
launchctl load /Library/LaunchDaemons/com.apple.blabla.plist
forward mongo to localhost
ssh -L 27017:localhost:27017 user@remoteMongoHost
ssh -L [localPort]:localhost:[remotePort] user@remoteMongoHost

#####change timezone on linux sudo ln -sf /usr/share/zoneinfo/UTC /etc/localtime

#####sftp with alias from ssh.config sftp uat-gdn03:/home/ec2-user/node3.tar


#####__TAR__ Tar Usage and Options c – create a archive file.
@avilshadow
avilshadow / gist:62851240d780fbbdf9c5
Created December 18, 2014 12:34
java UTF-8 conversions
StringEntity stringentity = new StringEntity(new String( corruptedString.getBytes()));
will show you what charset used: text/plain; charset=ISO-8859-1
String subjUTF8 = new String(corruptedString.getBytes("ISO-8859-1"), "UTF-8");
will make corrupted utf-8 look pretty
http://www.xtuple.org/PostgresOnLinuxServer
http://stackoverflow.com/questions/3004523/postgresql-database-default-location-on-linux