Skip to content

Instantly share code, notes, and snippets.

View scintill's full-sized avatar

Joey Hewitt scintill

View GitHub Profile
@scintill
scintill / amazonbitcoins.user.js
Created January 7, 2012 08:22
Amazon Bitcoins
// ==UserScript==
// @name Amazon Bitcoins
// @namespace joeyhewitt
// @description Show prices on Amazon in Bitcoin
// @match http://www.amazon.com/*
// @match https://www.amazon.com/*
// ==/UserScript==
// https://gist.github.com/437513
@scintill
scintill / imap-count.php
Created March 4, 2012 02:52
Dump message count from IMAP server
<?php
$host = '{imap.gmail.com:993/imap/ssl}';
$user = '';
$pass = '';
$imap = imap_open($host, $user, $pass, OP_READONLY | OP_HALFOPEN) or die("Can't connect: ".imap_last_error());
header('Content-Type: application/json');
echo json_encode(getCounts($imap, $host));
@scintill
scintill / googlereader_starredjson_to_bookmark_html.php
Created April 27, 2012 01:40
Convert Google Reader exported JSON of starred items to a Bookmark HTML file for importing in browser
<?php
ini_set('date.default_timezone', 'America/Denver');
?>
<!DOCTYPE NETSCAPE-Bookmark-file-1>
<!-- This is an automatically generated file.
It will be read and overwritten.
DO NOT EDIT! -->
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<TITLE>Bookmarks</TITLE>
<H1>Bookmarks</H1>
@scintill
scintill / README.md
Created June 23, 2012 22:05
rename a set of PDF's according to text found in each

The actual code (bash script) is very specific to what I was doing, but I'm putting it here so I can find it if I want to do something similar again. Or maybe it will help someone else!

@scintill
scintill / count-uniques.sh
Created June 23, 2012 22:12
get count of unique files in directory
#!/bin/bash
# the number of files, including any duplicates, is: ls -l | wc -l
sha256sum * | cut -d ' ' -f 1 | sort -u | wc -l
@scintill
scintill / pear.md
Created August 26, 2012 03:32
some PHP PEAR packages I always forget how to install

Zend

pear channel-discover zend.googlecode.com/svn
pear install zend/zend

PHPUnit

pear channel-discover pear.phpunit.de
pear channel-discover components.ez.no
pear channel-discover pear.symfony-project.com

pear install phpunit/PHPUnit

@scintill
scintill / colorguess.html
Created September 29, 2012 04:31
The computer guesses a color you choose from among several choices
<html>
<head>
<title>Color Guesser</title>
<script type="application/javascript">
var colors = ['maroon','red','orange','yellow','olive','purple','fuchsia','lime','green','navy','blue','aqua','teal','black','silver','gray'];
var bit = 1;
var total = 0;
@scintill
scintill / example.php
Last active December 10, 2015 16:28 — forked from xqus/example.php
<?php
// configure the ECC lib
if (!defined('USE_EXT')) {
if (extension_loaded('gmp')) {
define('USE_EXT', 'GMP');
} else if(extension_loaded('bcmath')) {
define('USE_EXT', 'BCMATH');
} else {
die('GMP or bcmath required. (GMP is faster).');
}
# -*- Mode: Python -*-
# OpenSSL wrapper
# https://github.com/joric/brutus/blob/master/ecdsa_ssl.py
import ctypes
import ctypes.util
ssl = ctypes.cdll.LoadLibrary (ctypes.util.find_library ('ssl') or 'libeay32')
@scintill
scintill / solarized256.php
Created October 13, 2013 01:27
convert powerline colorscheme to airline
" This attempts to replicate Powerline with the solarized256 colorscheme and the default theme.
" It was generated from the Powerline colorscheme struct and a script attempting to match powerline
" items to the Airline layout.
<?php
// TODO filename bold - accent?
$json = file_get_contents('solarized256.vimv');
$json = str_replace("'", '"', $json);
$powerlinedata = json_decode($json, true);
$palette = array();