Skip to content

Instantly share code, notes, and snippets.

@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);
@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 May 8, 2025 09:19
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
@dkandalov
dkandalov / plugin.groovy
Last active February 19, 2025 02:11
Quick and dirty plugin to find all dependencies of a class within project (including transitive)
import com.intellij.codeInsight.TargetElementEvaluator
import com.intellij.codeInsight.TargetElementUtilBase
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer
import com.intellij.lang.Language
import com.intellij.lang.LanguageExtension
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.module.ModuleManager
import com.intellij.openapi.progress.ProgressIndicator
import com.intellij.openapi.project.Project
import com.intellij.openapi.roots.ModifiableRootModel