Skip to content

Instantly share code, notes, and snippets.

@orendon
orendon / pg_dump_pg_restore.sh
Last active July 27, 2021 16:19
pg_dump pg_restore postgresql backup postgres
# Create and restore backups on PostgreSQL (tested on 9.2 and 9.3)
# create database backup
PGPASSWORD="XXX" pg_dump --no-owner --no-acl -U USER DATABASE -h HOST -F t > output_file.tar
# create database backup (heroku)
heroku pgbackups:capture
heroku pgbackups # show stored backups (assuming a117 is the desired one)
heroku pgbackups:url a117 # => it retrieves dump url on AWS S3
@orendon
orendon / delete_tag.sh
Created April 30, 2014 18:36
git delete tag
# delete git tag from remote
git tag -d tagname
git push origin :refs/tags/tagname
@orendon
orendon / add_ssh_key_deploy.sh
Created April 30, 2014 19:09
add ssh key to remote server authorized_keys
# add ssh key on remote server
cat ~/.ssh/id_rsa.pub | ssh user@server.com 'cat >> .ssh/authorized_keys'
@orendon
orendon / xclip_ssh_rsa.sh
Last active January 15, 2026 13:31
linux copy ssh rsa key, xclip xsel pbcopy (clipboard)
xclip -sel clip < ~/.ssh/id_rsa.pub
# in case you get a display null error
DISPLAY=:0 xclip -sel clip < ~/.ssh/id_rsa.pub
# osx
pbcopy < ~/.ssh/id_rsa.pub
## Alternative
@orendon
orendon / tux_commands.sh
Last active August 29, 2015 14:00
tux commands, nginx phusion passenger guide
# Deploying Ruby on Rails applications using Nginx and Phusion Passenger
#
# guideline commands were tested on ubuntu 14.04 server, ruby 2.1.1 and rails 4.1#
#
# create user on sudoers
useradd -d /home/orendon -s /bin/bash -G sudo -m orendon
# add 1024mb swap
sudo dd if=/dev/zero of=/swap bs=1M count=1024
@orendon
orendon / nginx-centos.sh
Last active August 29, 2015 14:00
nginx script debian, centos
#!/bin/sh
# from https://www.digitalocean.com/community/articles/how-to-deploy-rails-apps-using-passenger-with-nginx-on-centos-6-5
. /etc/rc.d/init.d/functions
. /etc/sysconfig/network
[ "$NETWORKING" = "no" ] && exit 0
nginx="/opt/nginx/sbin/nginx"
prog=$(basename $nginx)
@orendon
orendon / dyndns_crontab.sh
Created May 8, 2014 19:56
dyndns - update namecheap dynamic dns using crontab
# hourly
@hourly curl "https://dynamicdns.park-your-domain.com/update?host=HOST_NAME_HERE&domain=YOUR_DOMAIN_HERE&password=YOUR_PASSWORD_HERE&ip=`curl -s echoip.com`"
# every 30 min
0,30 * * * * curl "https://dynamicdns.park-your-domain.com/update?host=@&domain=YOUR_DOMAIN_HERE&password=YOUR_PASSWORD_HERE"
# ddclient (dns client alternative)
http://sourceforge.net/p/ddclient/wiki/Home/
@orendon
orendon / crouton_trusty_xfce
Last active November 22, 2015 23:05
error crouton + trusty with xfce
chronos@localhost / $ sudo startxfce4
Enter encryption passphrase for trusty:
Entering /usr/local/chroots/trusty...
/usr/bin/startxfce4: Starting X server
X.Org X Server 1.15.1
Release Date: 2014-04-13
X Protocol Version 11, Revision 0
Build Operating System: Linux 3.2.0-37-generic x86_64 Ubuntu
@orendon
orendon / crouton_precise_lxde
Created May 9, 2014 21:27
error ubuntu precise (lxde) on chromebook using crouton
chronos@localhost / $ sudo startlxde
Password:
Enter encryption passphrase for precise:
Entering /usr/local/chroots/precise...
X.Org X Server 1.11.3
Release Date: 2011-12-16
X Protocol Version 11, Revision 0
Build Operating System: Linux 2.6.42-37-generic x86_64 Ubuntu
#!/bin/sh
# A Ubuntu 14.04 install aimed for Ruby on Rails development
# This box start with a basic Ubuntu 14.04 (trusty) based on phusion/ubuntu-14.04-amd64
# And it adds the following packages aimed for rails development
# - rbenv and ruby-build
# - ruby 2.1.2 with bundler
# - Git 1.9.1