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
@techgaun
techgaun / redis-amzn-linux
Created October 17, 2014 19:19
redis 2.8.x installation on aws ec2 amazon linux
#!/bin/bash
#lost original file so rewrote for future reference, untested
#installs latest 2.8.17
#run as root
yum install -y gcc gcc-c++ make
wget "http://download.redis.io/releases/redis-2.8.17.tar.gz"
tar xvfz redis-2.8.17.tar.gz
rm -f redis-2.8.17.tar.gz
cd redis-2.8.17
make distclean && make
{
"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 / markdown-cmdline.md
Created October 29, 2014 16:20
markdown viewer in command line

Markdown Viewer in your terminal

  • markdown
apt-get install markdown lynx
markdown <markdown_file> | lynx -stdin
  • pandoc