Skip to content

Instantly share code, notes, and snippets.

View techgaun's full-sized avatar
🌌
Enum.random(["code", "sleep", "eat", "fifa", "soccer", "guitar", "board games"])

Samar Dhwoj Acharya techgaun

🌌
Enum.random(["code", "sleep", "eat", "fifa", "soccer", "guitar", "board games"])
View GitHub Profile
@techgaun
techgaun / postgres-backup
Created June 9, 2014 07:12
OpenShift Origin Cron for WAL-E
#!/bin/bash
# more at http://www.techgaun.com/2014/06/postgresql-backup-to-amazon-s3-on.html
if [ $OPENSHIFT_POSTGRESQL_DIR ]; then
/usr/bin/envdir /etc/wal-e.d/env /bin/wal-e backup-push ${OPENSHIFT_POSTGRESQL_DIR}data
fi
{
"title": "Apache logs",
"services": {
"query": {
"list": {
"0": {
"query": "*",
"alias": "",
"color": "#7EB26D",
"id": 0,
@techgaun
techgaun / docker-debug-mode
Created October 29, 2014 14:47
docker daemon in debug mode
/usr/bin/docker -d -D
@techgaun
techgaun / docker-ps-remove-exited-containers
Last active August 29, 2015 14:08
docker remove exited containers
docker ps -a | grep Exited | cut -d" " -f1 | xargs --no-run-if-empty docker rm
@techgaun
techgaun / wget-ftp
Created October 29, 2014 14:57
wget as a ftp client
wget -r -nH -m --ftp-user=<ftp_user> --ftp-password=<ftp_pwd> ftp://<ftp_server>/
@techgaun
techgaun / open-file-processes
Created October 29, 2014 15:01
get open file of processes
#!/bin/bash
for x in `ps -ef| awk '{ print $2 }'`;
do
echo "pid:${x} process_name:$(cat /proc/$x/cmdline) count:$(ls -1U /proc/$x/fd | wc -l)" | column -t;
done
@techgaun
techgaun / tar-extract-particular-file
Created October 29, 2014 15:04
extract particular file using tar
tar -xvf file.tar.gz --wildcards --no-anchored "<file_name>" -C /home/samar/path/to/extract/
@techgaun
techgaun / virsh-set-guest-memory
Created October 29, 2014 15:08
virsh set memory for guest
virsh setmem guest-name <new-memory-in-KB>
@techgaun
techgaun / git-tips.md
Last active August 29, 2015 14:09
Collection of miscellanous git tips

Collection of miscellanous git tips

Get current branch

git rev-parse --abbrev-ref HEAD
git symbolic-ref --short HEAD #probably works for 1.8 and newer clients
@techgaun
techgaun / graphicmagick-amzn-linux
Created November 13, 2014 20:02
Install GraphicMagick in Amazon Linux
#!/bin/bash
yum install -y gcc libpng libjpeg libpng-devel libjpeg-devel ghostscript libtiff libtiff-devel freetype freetype-devel
wget ftp://ftp.graphicsmagick.org/pub/GraphicsMagick/1.3/GraphicsMagick-1.3.20.tar.gz
tar xfz ftp://ftp.graphicsmagick.org/pub/GraphicsMagick/1.3/GraphicsMagick-1.3.20.tar.gz
cd GraphicsMagick-1.3.20
./configure
make
make install