Skip to content

Instantly share code, notes, and snippets.

View dossy's full-sized avatar
🍪
derping around

Dossy Shiobara dossy

🍪
derping around
View GitHub Profile
@malsup
malsup / jsonp
Created March 20, 2009 02:58
$.getJSONP
// fn to handle jsonp with timeouts and errors
// hat tip to Ricardo Tomasi for the timeout logic
$.getJSONP = function(s) {
s.dataType = 'jsonp';
$.ajax(s);
// figure out what the callback fn is
var $script = $(document.getElementsByTagName('head')[0].firstChild);
var url = $script.attr('src') || '';
var cb = (url.match(/callback=(\w+)/)||[])[1];
require 'digest/md5'
def gfm(text)
# Extract pre blocks
extractions = {}
text.gsub!(%r{<pre>.*?</pre>}m) do |match|
md5 = Digest::MD5.hexdigest(match)
extractions[md5] = match
"{gfm-extraction-#{md5}}"
end
@KevinGoodsell
KevinGoodsell / terminals.txt
Created December 17, 2010 00:32
The Trouble With Terminals
The Trouble With Terminals
Thu, 16 Dec 2010 16:43:20 -0800
Copyright 2010 Kevin Goodsell
0. License
This work is licensed under a Creative Commons
Attribution-NonCommercial-ShareAlike 3.0 Unported License. To view a
#!/bin/sh
# set -x
cmd=`php -r "require('$1');
echo escapeshellcmd(sprintf('mysql %s %s %s %s',
'-h' . DB_HOST, '-u' . DB_USER, '-p' . DB_PASSWORD, DB_NAME));"`
# echo $cmd
exec $cmd
@jtai
jtai / parse-tcpdump-udp-port-53.php
Last active January 16, 2019 16:06
Quick and dirty script to parse output of /usr/sbin/tcpdump -vvv -s 0 -l port 53
<?php
// quick and dirty argument parsing
foreach ($argv as $arg) {
if ($arg == '-f') {
define('FOLLOW', true);
}
if ($arg == '-h') {
define('HISTOGRAM', true);
}
@dcneiner
dcneiner / jquery.dontAnnoyDevsInWebkit.js
Created December 20, 2011 17:20
Removes the use of layerX and layerY in jQuery 1.4, 1.5, 1.6 (If you can't upgrade to jQuery 1.7 for some reason) - Even referencing these properties throws a warning in Chrome
// Add this code snippet after including jQuery
// The if statement protects you in case you forget to remove this
// once you upgrade to 1.7, or if you try to use it with jQuery 1.3
if (jQuery.event.props[17] === "layerX" ) {
jQuery.event.props.splice(17,2);
}
@mranney
mranney / emoji_sad.txt
Created January 30, 2012 23:05
Why we can't process Emoji anymore
From: Chris DeSalvo <[email protected]>
Subject: Why we can't process Emoji anymore
Date: Thu, 12 Jan 2012 18:49:20 -0800
Message-Id: <[email protected]>
--Apple-Mail=_6DEAA046-886A-4A03-8508-6FD077D18F8B
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=utf-8
@pfig
pfig / mkfavicon.sh
Created February 12, 2012 12:01
Make a multi-resolution favicon.ico from a source image, using ImageMagick
#!/bin/bash
# from
# http://bergamini.org/computers/creating-favicon.ico-icon-files-with-imagemagick-convert.html
convert source-WxW.png -resize 256x256 -transparent white favicon-256.png
convert favicon-256.png -resize 16x16 favicon-16.png
convert favicon-256.png -resize 32x32 favicon-32.png
convert favicon-256.png -resize 64x64 favicon-64.png
convert favicon-256.png -resize 128x128 favicon-128.png
@claylevering
claylevering / bitly.sh
Created February 15, 2012 02:20
Bit.ly Alfred App Extension
# modified API url to align with changes to bit.ly requirements - @claylevering
# find the .alfredextension here: http://cl.ly/EEUK
declare -r API='https://api-ssl.bitly.com/v3/shorten'
declare -r LOGIN='yourlogin'
declare -r API_KEY='yourapi'
# add http scheme to URL if none is provided
longURL=$(printf "{query}" | sed -E -e 's|^.|http://&|' -e 's|^http://([a-zA-Z\-\.\+]+://)|\1|')
@dossy
dossy / ipmitool-1.8.11-99.dell.patch
Created May 30, 2012 20:26
Dell patches to ipmitool-1.8.11 from Redhat SRPM
This file has been truncated, but you can view the full file.
The following patch is a combination of the Dell contributions to ipmitool, taken from the following Dell tarball for the corresponding RPM:
http://opensource.dell.com/releases/BMU/ipmitool-1.8.11-99.dell.tar.bz2
This patch was generated by diff'ing the upstream ipmitool-1.8.11 source against the ipmitool-1.8.11-99.dell source, with the following command:
% diff -urN -x .git -x autom4te.cache -x Makefile -x config.h -x config.log -x config.status -x '*.keep' -x .deps -x '*.spec' ipmitool-1.8.11 ipmitool-1.8.11-99.dell > ipmitool-1.8.11-99.dell.patch
Release Notes.txt | 9
ipmitool-1.8.11-99.dell/CHANGES.txt | 8