Skip to content

Instantly share code, notes, and snippets.

View dasgoll's full-sized avatar

dasgoll

  • Amman, Jordan
View GitHub Profile
@jordansissel
jordansissel / site.pp
Created October 15, 2010 19:56
Simplest example of a masterless puppet invocation using module paths
include foo
@esmooov
esmooov / ctrr.md
Created May 25, 2012 16:50
Carats and Tildes, Resets and Reverts

Until last night I lived in fear of tildes, carats, resets and reverts in Git. I cargo culted, I destroyed, I laid waste the tidy indicies, branches and trees Git so diligently tried to maintain. Then Zach Holman gave a talk at Paperless Post. It was about Git secrets. He didn't directly cover these topics but he gave an example that made me realize it was time to learn.

A better undo

Generally, when I push out bad code, I panic, hit git reset --hard HEAD^, push and clean up the pieces later. I don't even really know what most of that means. Notational Velocity seems to be fond of it ... in that I just keep copying it from Notational Velocity and pasting it. Turns out, this is dumb. I've irreversibly lost the faulty changes I made. I'll probably even make the same mistakes again. It's like torching your house to get rid of some mice.

Enter Holman. He suggests a better default undo. git reset --soft HEAD^. Says it stag

@kenjiskywalker
kenjiskywalker / centos6.ks
Created November 23, 2012 09:05
CentOS 6.3 install on KVM from kickstart
# Kickstart file automatically generated by anaconda.
#version=RHEL6
install
rootpw --iscrypted [HASH PASSWORD]
text
keyboard us
lang en_US.UTF-8
selinux --disabled
timezone --utc Asia/Tokyo
@esycat
esycat / README.md
Last active October 30, 2023 10:52
How to get GNU's readlink -f behavior on OS X.

readlink.sh is a pure shell implementation that uses dirname, basename, readlink and pwd utils. Note that you cannot rename it to just readlink as then the script will call itself instead of the system utility.

realpath script simply calls Python's os.path.realpath. Python is provided in OS X and major Linux distributions. You can use instead of the system utility by making a symlink: ln -s realpath readlink.

Another way is to install coreutils package via Homebrew or MacPorts and use greadlink.

The code is taken from the following page on StackOverflow: http://goo.gl/Yw9OY

@imagescape
imagescape / Install Openssh from Source
Created April 8, 2013 14:37
Install openssh in an alternate location from source
# We will assume installation in the /opt/ directory
mkdir /opt/openssh/
cd /opt/openssh/
# gather and install the dependencies
wget http://zlib.net/zlib-1.2.7.tar.bz2
tar jxvf zlib-1.2.7.tar.bz2
cd zlib-1.2.7
./configure --prefix=/opt/openssh/dist/
@sr75
sr75 / wildcard-ssl-cert-for-testing-nginx-conf.md
Created June 1, 2013 18:35
create a self signed wildcard ssl cert for testing with nginx.conf example

just change out app_name for your purposes

openssl genrsa 2048 > app_name-wildcard.key

openssl req -new -x509 -nodes -sha1 -days 3650 -key app_name-wildcard.key > app_name-wildcard.cert

# Common Name (eg, your name or your server's hostname) []:*.app_name.com

openssl x509 -noout -fingerprint -text < app_name-wildcard.cert > app_name-wildcard.info
@jmnwong
jmnwong / ST2 Cycle Tabbing
Created June 28, 2013 15:24
Makes CTRL-Tab cycle tabs in order for Sublime Text.
Put in (Preferences -> Key Bindings - User):
{ "keys": ["ctrl+tab"], "command": "next_view" },
{ "keys": ["ctrl+shift+tab"], "command": "prev_view" }
@ushu
ushu / S3 buckets copy.md
Created October 29, 2013 16:12
Copy between S3 buckets w/ different accounts

This is a mix between two sources:

basically the first resource is great but didn't work for me: I had to remove the trailing "/*" in the resource string to make it work. I also noticed that setting the policy on the source bucket was sufficient. In the end these are the exact steps I followed to copy data between two buckets on two accounts

Basically the idea there is:

  • we allowe the destination account to read the source bucket (in the console for the source account)
  • we log as the destination and start the copy
@amolkhanorkar
amolkhanorkar / PG::Error: ERROR: new encoding (UTF8) is incompatible
Last active November 29, 2023 17:57
Postgres PG::Error: ERROR: new encoding (UTF8) is incompatible
======= Prolbem =================================================================================================================
I have installed : ruby-2.0.0,postgres-9.2 , now in rails app when I execute:
rake db:create , command I get:
PG::InvalidParameterValue: ERROR: new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII)
HINT: Use the same encoding as in the template database, or use template0 as template.
: CREATE DATABASE "my_db_name" ENCODING = 'unicode'.......
bin/rake:16:in `load'
@mitmul
mitmul / install_opencv2.4.8.sh
Last active April 27, 2018 18:29
install OpenCV 2.4.8 for CentOS 6.2
#! /bin/bash
sudo yum install -y gcc g++ gtk+-devel libjpeg-devel libtiff-devel jasper-devel libpng-devel zlib-devel cmake unzip
sudo yum install -y yum-priorities
wget http://ftp-srv2.kddilabs.jp/Linux/distributions/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
sudo rpm -ivh epel-release-6-8.noarch.rpm
sudo yum install -y eigen3-devel —enablerepo=epel
pip install numpy
wget http://downloads.sourceforge.net/project/opencvlibrary/opencv-unix/2.4.8/opencv-2.4.8.zip
unzip opencv-2.4.8