Skip to content

Instantly share code, notes, and snippets.

@jagregory
jagregory / gist:710671
Created November 22, 2010 21:01
How to move to a fork after cloning
So you've cloned somebody's repo from github, but now you want to fork it and contribute back. Never fear!
Technically, when you fork "origin" should be your fork and "upstream" should be the project you forked; however, if you're willing to break this convention then it's easy.
* Off the top of my head *
1. Fork their repo on Github
2. In your local, add a new remote to your fork; then fetch it, and push your changes up to it
git remote add my-fork git@github...my-fork.git
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active July 27, 2024 16:01
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@johnryan1982
johnryan1982 / JS console SQL generation
Created July 5, 2012 17:35
Quick way to generate multiple SQL INSERT statements etc. using a browser's console
str = '';
for(var i=0; i<1000; i++){
str += "INSERT INTO VALUES ("+i+1000+")...;";
}
document.getElementsByTagName('body')[0].innerHTML = "<textarea>"+str+"</textarea>";
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active July 27, 2024 16:50
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@john2x
john2x / gist:3871758
Created October 11, 2012 11:32
xero 2-legged oauth
function test() {
var requestURL = "https://api.xero.com/api.xro/2.0/Accounts",
timestamp = (new Date().valueOf()/1000).toFixed(0),
nonce = createGuid(),
key = "consumer key from xero private app",
publickey = "content of publickey.cer",
requestData = {
"method": "GET",
"contentType": "application/xml",
"headers": {
@andelf
andelf / sendMail.go
Last active September 20, 2023 15:13
golang send mail net/smtp SMTP
package main
import (
"log"
"net/mail"
"encoding/base64"
"net/smtp"
"fmt"
"strings"
@jeremykendall
jeremykendall / example.pp
Created September 27, 2013 03:33
Changing apache user and group in /etc/apache2/envvars using sed in a puppet exec. Stolen from https://github.com/Intracto/Puppet/blob/master/apache2/manifests/init.pp#L12-L26
exec { "sed -i 's/www-data/vagrant/g' /etc/apache2/envvars":
onlyif => "/bin/grep -c 'www-data' /etc/apache2/envvars",
notify => Service['apache2'],
require => Package['apache2'],
}
@posva
posva / vim.rb
Created November 14, 2013 12:49
Homebrew Formula to install vim with python support and many other things. Originally from http://mikegrouchy.com/blog/2012/05/compile-vim-with-python-support-on-osx-with-homebrew.html
require 'formula'
class Vim < Formula
homepage 'http://www.vim.org/'
url 'https://vim.googlecode.com/hg/', :revision => '6c318419e331'
version '7.3.515'
def features; %w(tiny small normal big huge) end
def interp; %w(lua mzscheme perl python python3 tcl ruby) end
@macbleser
macbleser / wp-permissions-script
Created February 21, 2014 15:37
WordPress Permissions Configuration Script
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro
#
WP_OWNER=changeme # &lt;-- wordpress owner
WP_GROUP=changeme # &lt;-- wordpress group
WP_ROOT=/home/changeme # &lt;-- wordpress root directory
@davidvthecoder
davidvthecoder / round.go
Created April 9, 2014 19:58
Arggh Golang does not include a round function in the standard math package. So I wrote a quick one.
package main
import (
"log"
"math"
)
func Round(val float64, roundOn float64, places int ) (newVal float64) {
var round float64
pow := math.Pow(10, float64(places))