Skip to content

Instantly share code, notes, and snippets.

@nicolasramy
nicolasramy / pip.sh
Created January 30, 2014 00:20
Simple bash_completion file: pip, venv-* functions. (venv-functions details: https://gist.github.com/nicolasramy/6438236#file-bash_functions_python)
#!/bin/sh
_pip_completion() {
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
first="${COMP_WORDS[0]}"
commands=$($first --help | awk '/Commands\:/,/General Options\:/' | \
\grep -E -o "^\s{2}\w*" | tr -d ' ')
opts=$($first --help | \grep -E -o "((-\w{1}|--(\w|-)*=?)){1,2}")
@nicolasramy
nicolasramy / Dockerfile
Last active August 29, 2015 13:57
Pourquoi continuer à utiliser une VM quand on peut faire autrement ?
FROM ubuntu
MAINTAINER Nicolas Ramy "nicolas.ramy@darkelda.com"
RUN echo "deb http://archive.ubuntu.com/ubuntu/ precise universe" >> /etc/apt/sources.list
RUN apt-get update
RUN apt-get -y upgrade
# Keep upstart for complaining
RUN dpkg-divert --local --rename --add /sbin/initctl
RUN ln -sf /bin/true /sbin/initctl
@nicolasramy
nicolasramy / deploy.sh
Last active August 29, 2015 14:03
Simple script to deploy static websites + snapshot generation through SSH
#/bin/bash
PROJECT_NAME=my_website
WORKSPACE=/var/www
USERNAME=www-data
PORT=22
DATEMARK=`date +%Y%m%d%H%M%S`
HOSTNAME=www.example.com

Keybase proof

I hereby claim:

  • I am nicolasramy on github.
  • I am darkelda (https://keybase.io/darkelda) on keybase.
  • I have a public key whose fingerprint is 5C9A 3938 ACF5 D542 952F 20D9 812F 03FE DF16 418C

To claim this, I am signing this object:

@nicolasramy
nicolasramy / install-debian
Created July 30, 2012 15:36
Installation script for debian / ubuntu
# First step
apt-get update
apt-get upgrade
# Error
# W: mdadm: /etc/mdadm/mdadm.conf defines no arrays.
# W: mdadm: no arrays defined in configuration file.
>> Need a solution to solve this problem
@nicolasramy
nicolasramy / md5.sh
Created December 5, 2012 12:47
Calculate MD5
#!/bin/bash
echo -n $1 | md5sum
@nicolasramy
nicolasramy / tips-git.md
Last active December 14, 2015 11:39
Tips for git: manage remotes, branches, tags and history

Git Cheat Sheet

Remote

Add remote RemoteName from specific URL (SSH)

git remote add RemoteName git@git.hostname.com:repository.git

Get informations about the remote

git remote show origin
@nicolasramy
nicolasramy / mysql-cs-01-introduction.md
Last active December 14, 2015 11:59
Tips for MySQL

MySQL Cheat Sheet

Databases

Tables

Create

Create ... Select

@nicolasramy
nicolasramy / iptables.md
Last active December 14, 2015 11:59
Tips for Debian System Administration - Installation, Configuration, Useful commands and Tools

IP Tables

Block IP

Block a specific IP

iptables -A INPUT -s 31.2.41.8 -j DROP

Block a range (31.2.41.*)

Magento Cheat Sheet

Code

Design

Template

URLs