Skip to content

Instantly share code, notes, and snippets.

View scintill's full-sized avatar

Joey Hewitt scintill

View GitHub Profile
@scintill
scintill / interleave.php
Created October 31, 2013 07:55
"Interleave" two strings in every possible way.
<?php
/*
* "Interleave" two strings in every possible way.
* interleave('ABC', 'DE') =
* ABCDE ABDCE ABDEC ADBCE ADBEC ADEBC DABCE DABEC DAEBC DEABC
*
* Nothing real special here, just thought it was an interesting
* problem that gets annoying for humans but after some thought is
* quite simple to a programmer and a computer.
@scintill
scintill / elements-dictionary.php
Last active December 27, 2015 01:29
PHP to spell words with symbols from the periodic table
<?php
/**
* Similar to elements.php, but with all words in a dictionary.
*/
require_once('elements.php');
$els = getElements();
$mostMatchesLen = 0;
$mostMatches = '';
@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();
# -*- 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 / 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).');
}
@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 / 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 / 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 / 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 / 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>