Skip to content

Instantly share code, notes, and snippets.

View qbit's full-sized avatar
🐡
blub blub

Aaron Bieber qbit

🐡
blub blub
View GitHub Profile
@qbit
qbit / npm_openbsd
Created May 1, 2011 16:06
openbsd npm install fix
diff --git a/lib/utils/tar.js b/lib/utils/tar.js
index 8c5bf94..ffa4ac1 100644
--- a/lib/utils/tar.js
+++ b/lib/utils/tar.js
@@ -167,11 +167,18 @@ function gunzTarPerm (tarball, tmp, dMode, fMode, uid, gid, cb) {
//console.error(npm.config.get("gzipbin")+" --decompress --stdout "
// +tarball+" | "+npm.config.get("tar")+" -mvxpf - --no-same-owner -C "
// +tmp)
+ var os = require("os");
+ var opts = [ "-mvxpf", "-", "--no-same-owner", "-C", tmp];
@qbit
qbit / gist:1078137
Created July 12, 2011 14:54
npm install sqlite3 failed on debian squeeze
info it worked if it ends with ok
verbose cli [ 'node', '/usr/bin/npm', 'install', 'sqlite3' ]
info using npm@1.0.15
info using node@v0.4.9
verbose config file /home/qbit/.npmrc
verbose config file /usr/etc/npmrc
silly testEngine { name: 'application-name',
silly testEngine version: '0.0.1',
silly testEngine private: true,
silly testEngine dependencies: { express: '2.3.11', ejs: '>= 0.0.1' },
@qbit
qbit / gist:1310855
Created October 25, 2011 00:01
despotify patch for openbsd
Index: src/lib/dns.c
===================================================================
--- src/lib/dns.c (revision 516)
+++ src/lib/dns.c (working copy)
@@ -12,7 +12,14 @@
#include <windns.h>
#elif defined __use_posix__
#include <arpa/nameser.h>
+#ifdef __use_openbsd__
+#define ns_c_in C_IN
@qbit
qbit / gist:1320940
Created October 27, 2011 21:30
Working patch for despotify on openbsd
Index: src/lib/dns.c
===================================================================
--- src/lib/dns.c (revision 516)
+++ src/lib/dns.c (working copy)
@@ -12,7 +12,14 @@
#include <windns.h>
#elif defined __use_posix__
#include <arpa/nameser.h>
+#ifdef __use_openbsd__
+#define ns_c_in C_IN
@qbit
qbit / gist:1403198
Created November 29, 2011 03:10
Bookmarklet to de-crazy font/bg color combos
javascript: var a=document.getElementsByTagName("*");if(a){var i=a.length;var e;do{e=a[i];if(e){void(e.style.background='#fff');void(e.style.color='#000');}}while(--i);}else{}
@qbit
qbit / gist:2024705
Created March 12, 2012 21:11
Crappy dropbox clone using svn
#!/bin/bash
IFS=$'\n'
SYNC_DIRS=`cat directory_list.txt`
WD=`pwd`
function loop {
for dir in $SYNC_DIRS; do
cd $dir
IFS=$'\n'
@qbit
qbit / instapaper.js
Created September 13, 2012 01:39
Xombrero to Instapaper script
/*
* Script to add read-later urls to instapaper from xombrero
*
* - slightly modified version of the "Read Later" button
*
* To use change OMGAWESOME to the key from the "Read Later" button
* source.
*/
var d = document,
@qbit
qbit / gist:5483415
Last active February 25, 2024 13:35
KSH support for git-prompt
# ksh git prompt support
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Distributed under the GNU General Public License, version 2.0.
#
# This script allows you to see repository status in your prompt.
#
# To enable:
#
# 1) Copy this file to somewhere (e.g. ~/.git-prompt.sh).
@qbit
qbit / ksh_osx.diff
Last active January 22, 2016 01:18
Diff to make OpenBSD's pdksh work on OSX.
diff --git a/Makefile b/Makefile
index c3a880c..c07ae39 100644
--- a/Makefile
+++ b/Makefile
@@ -17,6 +17,9 @@ OBJS+= openbsd/strlcat.o openbsd/strlcpy.o openbsd/setmode.o \
DEFS= -Wall -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 \
-DSYSTYPE=\"${OSTYPE}\"
CFLAGS+= ${DEFS} -I. -I${.CURDIR}
+.if ${OSTYPE} == "Darwin"
+LDFLAGS+= -arch x86_64
@qbit
qbit / getdata.js
Last active December 25, 2015 00:09
lobste.rs filter data
var tagData = [];
$('#story_tags_a option').each(function() {
var count = $(this).attr('data-html').replace(/.*<em>(.*)<\/em>.*/, "$1"), val, o = {};
if ( count.match(/\d/) ) {
o.value = count.replace(/^(\d+).*/, "$1");
} else {
o.value = 0;
}
o.label = $(this).val();