Skip to content

Instantly share code, notes, and snippets.

@bandicoot86
bandicoot86 / gist:b878aaa1f30fa4fe5dcc
Created July 1, 2014 08:07
Install nodejs on CentOs
yum install gcc gcc-c++
yum install autoconf automake make
yum install curl
yum install openssl-devel
wget http://nodejs.org/dist/v0.10.17/node-v0.10.17.tar.gz
tar zxvf node-v0.10.17.tar.gz
cd node-v0.10.17
./configure
make CFLAGS+=-fno-builtin-memcpy CXXFLAGS+=-fno-builtin-memcpy V=1
make install
@bandicoot86
bandicoot86 / gist:0eaf3d787c6e68f291b7
Created July 3, 2014 15:43
Find one string per file and copy
grep -Ril -m1 "exportData" | xargs -L 1 -i cp {} /home/astrloger/1_part_RTK/export/
@bandicoot86
bandicoot86 / gist:dcda4d70b44e6b1c6a32
Created July 7, 2014 07:39
Revert last commit, GIT
Undo a commit and redo
$ git commit ... (1)
$ git reset --soft HEAD~1 (2)
$ edit (3)
$ git add .... (4)
$ git commit -c ORIG_HEAD (5)
This is what you want to undo
This is most often done when you remembered what you just committed is incomplete, or you misspelled your commit message, or both. Leaves working tree as it was before "reset". (The quotes may or may not be required in your shell)
@bandicoot86
bandicoot86 / gist:74452cce2fbe7c549f6e
Created July 8, 2014 12:08
Git stash patch abbreviations
patch
This lets you choose one path out of a status like selection. After choosing the path, it presents the diff between the index and the working tree file and asks you if you want to stage the change of each hunk. You can select one of the following options and type return:
y - stage this hunk
n - do not stage this hunk
q - quit; do not stage this hunk nor any of the remaining ones
a - stage this hunk and all later hunks in the file
d - do not stage this hunk nor any of the later hunks in the file
g - select a hunk to go to
/ - search for a hunk matching the given regex
http://habrahabr.ru/post/66931/
@bandicoot86
bandicoot86 / gist:985e1ed57e4bbd75c56c
Created August 27, 2014 21:00
Create localhost certificate
openssl genrsa -out cloueda-key.pem 1024
openssl req -new -key cloueda-key.pem -out certrequest.csr
--common name localhost
openssl x509 -req -in certrequest.csr -signkey cloueda-key.pem -out cloueda-cert.pem
@bandicoot86
bandicoot86 / gist:c49fb92c4cc63b7bd74a
Created September 8, 2014 14:14
Set time zone ubuntu
rm -rf /etc/localtime
ln -s /usr/share/zoneinfo/Europe/Moscow /etc/localtime
date
--Thu May 14 10:13:03 MSD 2009
@bandicoot86
bandicoot86 / gist:9f95f1cd5f9e65d9fad6
Created September 11, 2014 10:26
Edit crons in nano
env EDITOR=nano crontab -e
sudo add-apt-repository ppa:attente/modifier-only-input-switch
sudo apt-get update
sudo apt-get upgrade
@bandicoot86
bandicoot86 / gist:d42faf98ce9e700d14c7
Created October 30, 2014 19:46
Replace new lines with \n
awk '{printf("%s\\n",$0)} END {print ""}' 1.txt