Skip to content

Instantly share code, notes, and snippets.

{
"query": {
"bool": {
"should": [
{
"simple_query_string": {
"fields": [
"name^3",
"description",
"service_location",
@pib
pib / float_bug.go
Last active March 3, 2016 00:11
Demonstration of float scan bug in github.com/go-sql-driver/mysql
package main
import (
"database/sql"
"fmt"
"log"
_ "github.com/go-sql-driver/mysql"
)
{
location: {
city: "Austin",
state: "TX"
},
category: {
name: "Professional Services",
id: 42,
"description": "Welcome to Austin, Texas's best directory brought to you by the OwnLocal. Check out businesses like Dime Box Cattle Co...",
"images": [
@pib
pib / cupid.lua
Created January 25, 2014 08:03
An in-progress fix of cupid for Love 0.9.0
-----------------------------------------------------
-- (C) Robert Blancakert 2012
-- Available under the same license as Love
-----------------------------------------------------
-----------------------------------------------------
-- Cupid Configuration
-----------------------------------------------------
@pib
pib / fakeserver.sh
Created February 4, 2013 21:32
Sometimes you just want to see a raw, incoming HTTP request.
BODY="$1"
if [ -z "$1" ]; then
BODY="OK"
fi
{
echo -ne "HTTP/1.0 200 OK\r\nContent-Length: $(echo $BODY| wc -c)\r\n\r\n"
echo $BODY
} | nc -l 8080 -v
@pib
pib / playtime.py
Created October 18, 2012 17:45
Script to count the total time in a directory full of MP3s
from os import walk
from os.path import join
from subprocess import check_output
SEC_PER_MIN = 60
SEC_PER_HOUR = 60 * SEC_PER_MIN
SEC_PER_DAY = 24 * SEC_PER_HOUR
def split_time(seconds):
@pib
pib / datehist.py
Created July 9, 2012 15:29 — forked from andrewsomething/datehist.py
Plot a histogram of mailinglist activity
#!/usr/bin/env python
"""
Plot histogram from list of dates
Usage
=====
Point to mbox file.
Ex.1: plot mailinglist activity::
@pib
pib / playndeps.txt
Created May 10, 2012 14:46
A listing of all the stuff that maven installed just to run the boilerplate PlayN game.
/Users/pbonser/.m2/
└── repository
├── antlr
│   └── antlr
│   └── 2.7.7
│   ├── _maven.repositories
│   ├── antlr-2.7.7.jar
│   ├── antlr-2.7.7.jar.sha1
│   ├── antlr-2.7.7.pom
│   └── antlr-2.7.7.pom.sha1
@pib
pib / canttouchthis.sh
Created April 24, 2012 14:02
Can't Touch This
pib@quabee:~$ sudo touch this
[sudo] password for pib:
pib@quabee:~$ sudo chmod 600 this
pib@quabee:~$ touch this
touch: cannot touch `this': Permission denied
pib@quabee:~$
@pib
pib / gist:1320092
Created October 27, 2011 16:42
Injecting a QNetworkAccessManager
def inject(self, webview):
""" Replace the old QNetworkAccessManager instance with this
instance.
"""
old_manager = webview.page().networkAccessManager()
self.setCache(old_manager.cache())
self.setCookieJar(old_manager.cookieJar())
self.setProxy(old_manager.proxy())
self.setProxyFactory(old_manager.proxyFactory())