Skip to content

Instantly share code, notes, and snippets.

# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
# Version 2, December 2004
#
# Copyright (C) 2004 Sam Hocevar
# 14 rue de Plaisance, 75014 Paris, France
# Everyone is permitted to copy and distribute verbatim or modified
# copies of this license document, and changing it is allowed as long
# as the name is changed.
#
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@ecarnevale
ecarnevale / prepare-commit-msg.sh
Created October 3, 2019 16:15 — forked from wingleung/prepare-commit-msg.sh
Automatically prepend JIRA issue key to commit message
#!/bin/sh
#
# Automatically adds Jira key to commit message
#
if [ -z "$BRANCHES_TO_SKIP" ]; then
BRANCHES_TO_SKIP=(master develop)
fi
BRANCH_NAME=$(git symbolic-ref --short HEAD)
@ecarnevale
ecarnevale / api_client.empty.exs
Created May 16, 2017 10:41
Code snippets for a blog post on ExVCR
# test/support/api_client.exs
defmodule ExVCR.Adapter.HackneyTest do
use ExUnit.Case, async: false
use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney
setup_all do
HTTPoison.start
end
import Alamofire
let urlString = "http://example.org/Webserver.WcfService.Service"
let headers: HTTPHeaders = [
"Accept" : "text/xml",
"Content-Type" : "text/xml; charset=UTF-8",
"SOAPAction": "http://tempuri.org/Service/GetInfo" //this is important and the value depends on your WSDL, but with our experiments, without this header nothing works
]
let parameters: Parameters = [
"UserName": "username",
@ecarnevale
ecarnevale / gist:216995
Created October 23, 2009 15:49
hack for a quick fix of Raindrop
diff -r e07f7793ad1b server/python/raindrop/proto/imap.py
--- a/server/python/raindrop/proto/imap.py Fri Oct 23 15:10:01 2009 +1100
+++ b/server/python/raindrop/proto/imap.py Fri Oct 23 17:48:16 2009 +0200
@@ -102,7 +102,7 @@
# Probably: http://twistedmatrix.com/trac/ticket/1443
# "[imap4] mismatched quoting spuriously raised" - raised early 2006 :(
try:
- imap4.IMAP4Client._defaultHandler(self, tag, rest)
+ imap4.IMAP4Client._defaultHandler(self, str(tag), str(rest))
except imap4.MismatchedQuoting, exc:
@ecarnevale
ecarnevale / fullscreen-24.diff
Created March 29, 2012 15:03
Add ns-toggle-fullscreen to Emacs 24
diff --git a/lisp/term/ns-win.el b/lisp/term/ns-win.el
index 084b62f..b7ed1a2 100644
--- a/lisp/term/ns-win.el
+++ b/lisp/term/ns-win.el
@@ -1267,6 +1267,10 @@ the operating system.")
(add-to-list 'window-system-initialization-alist '(ns . ns-initialize-window-system))
+(declare-function ns-toggle-fullscreen-internal "nsfns.m" ())
+(defun ns-toggle-fullscreen ()
@ecarnevale
ecarnevale / gist:2108860
Created March 19, 2012 11:47 — forked from marcel/gist:2100703
giftube – Generates an animated gif from a YouTube url.
#!/usr/bin/env ruby
# giftube – Generates an animated gif from a YouTube url.
#
# Usage:
#
# giftube [youtube url] [minute:second] [duration]
#
# ex.
#
@ecarnevale
ecarnevale / gist:1884033
Created February 22, 2012 10:24
put in your ~/.profile
function _ssh_completion() {
perl -ne 'print "$1 " if /^Host (.+)$/' ~/.ssh/config
}
complete -W "$(_ssh_completion)" ssh
#!/usr/bin/python
#builtin
import re, shutil, json, urllib2, os, sys
from string import Template
from subprocess import call
#external
import netifaces
12096 dotadmin 20 0 62208 40m 3036 S 0.0 1.0 0:31.08 ruby
13249 dotadmin 20 0 61916 40m 3052 S 0.0 1.0 0:04.09 ruby
13244 dotadmin 20 0 53200 33m 3556 S 0.0 0.8 0:02.10 ruby
10735 mysql 20 0 134m 23m 3664 S 0.0 0.6 50:41.22 mysqld
10547 root 20 0 22096 9596 1516 S 0.0 0.2 7:29.37 ruby
2530