Skip to content

Instantly share code, notes, and snippets.

View soberich's full-sized avatar

soberich

  • Amsterdam, The Netherlands
View GitHub Profile
@tylerhall
tylerhall / SafariToFFCookies.php
Created August 19, 2010 20:58
Converts your Safari cookies into the standard Netscape (Firefox) format.
#!/usr/bin/php
<?PHP
$plist = file_get_contents($_ENV['HOME'] . '/Library/Cookies/Cookies.plist');
preg_match_all('/<dict>(.*?)<\/dict>/ms', $plist, $matches);
$dicts = $matches[1];
$fp = fopen('cookies.txt', 'w');
foreach($dicts as $dict)
{
$domain = match('/Domain<\/key>.*?<string>(.*?)<\/string>/ms', $dict, 1);
@MicahElliott
MicahElliott / colortrans.py
Created November 29, 2010 07:57
Convert values between RGB hex codes and xterm-256 color codes.
#! /usr/bin/env python
""" Convert values between RGB hex codes and xterm-256 color codes.
Nice long listing of all 256 colors and their codes. Useful for
developing console color themes, or even script output schemes.
Resources:
* http://en.wikipedia.org/wiki/8-bit_color
* http://en.wikipedia.org/wiki/ANSI_escape_code
@fsouza
fsouza / add_prefix.py
Created September 8, 2011 23:01
Removes prefix to your contacts on Google Contacts
# -*- coding: utf-8 -*-
import gdata.contacts.client
import gdata.contacts.data
USER = ""
PASSWD = ""
PREFIX = '041'
def add_prefix_to_contacts(gd_client, prefix):
@djberg96
djberg96 / flag_to_string.rb
Created January 10, 2012 20:02
Trying to stringify filesystem flags
require 'ffi'
class Filesystem
extend FFI::Library
ffi_lib FFI::Library::LIBC
attach_function(:strerror, [:int], :string)
attach_function(:getmntinfo64, [:pointer, :int], :int)
class Statfs < FFI::Struct
@DAddYE
DAddYE / hack.sh
Created March 19, 2012 11:31
OSX For Hackers
#!/bin/sh
##
# This is a script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# Run in interactive mode with:
# $ sh -c "$(curl -sL https://raw.github.com/gist/2108403/hack.sh)"
#
# or run it without prompt questions:
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active September 10, 2025 19:42
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%'
@smileart
smileart / README.md
Last active March 16, 2024 15:42 — forked from agnoster/README.md
My ZSH Theme — Agnoster Mod

My modified fork of agnoster.zsh-theme

A ZSH theme optimized for people who use:

  • Solarized
  • Git
  • Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)

Compatibility

@xkikeg
xkikeg / zshhist.py
Last active March 13, 2025 11:51
Convert ZSH history file (.zsh_history file) between original weird encoding and proper UTF-8.
#!/usr/bin/env python3
"""
ZSH history convert script.
When you mistakenly type your password or quite bad command into ZSH,
you may want to remove the entry from the history.
The problem is, the .zsh_history is encoded in a weird format!
If you want to find a command with non-ASCII character, it'll be problematic.
@jirutka
jirutka / MOXyContextResolver.java
Created March 27, 2013 15:47
EclipseLink MOXy helpers for better handling of namespaces.
/* Copyright 2013 Jakub Jirutka. All rights reserved.
*
* "THE KOFOLA-WARE LICENSE" (Revision 1):
* Jakub Jirutka originally wrote this file. As long as you retain this notice you
* can do whatever you want with this stuff. If we meet some day, and you think
* this stuff is worth it, you can buy me a Kofola in return. <[email protected]>
*/
import java.io.File;
import java.io.FileNotFoundException;
@edwardbeckett
edwardbeckett / build.gradle
Created April 13, 2013 06:59
mysema.querydsl gradle
sourceSets {
generated {
java {
srcDirs = ['src/main/generated']
}
}
}
configurations {
querydslapt