Skip to content

Instantly share code, notes, and snippets.

View donatj's full-sized avatar
🥽
Getting back to business

Jesse Donat donatj

🥽
Getting back to business
View GitHub Profile
@oranj
oranj / apache_fetch.php
Created May 15, 2012 19:46
Apache Open Directory Fetch
#!/usr/bin/php
<?php
if (! isset($argv[1])) {
fputs(STDERR, "Please provide a URL to crawl\n");
die(1);
}
if (! isset($argv[2])) {
fputs(STDERR, "Please provide an output filename\n");
@mreid
mreid / lz77-encode.py
Last active July 21, 2019 02:59
A simple implementation of the LZ77 algorithm, as described in §13.4 of Cover and Thomas' "Information Theory" book. (Note: python is not my first choice of language so this code is probably non-idiomatic).
# LZ77 Encoding
#
# Simple implementation of Lempel-Ziv 77 (a.k.a. "Sliding Window") coding
# as described in Section 13.4 of Cover & Thomas' "Information Theory".
#
# USAGE: python encode.py INPUT_STREAM
#
# EXAMPLE (from lectures):
# $ python encode.py abbababbababbab
# (0,a)
@donatj
donatj / ColorCLI.php
Created October 26, 2011 03:34
Simple CLI color class
<?php
class ColorCLI {
static $foreground_colors = array(
'bold' => '1', 'dim' => '2',
'black' => '0;30', 'dark_gray' => '1;30',
'blue' => '0;34', 'light_blue' => '1;34',
'green' => '0;32', 'light_green' => '1;32',
'cyan' => '0;36', 'light_cyan' => '1;36',
@amitmerchant1990
amitmerchant1990 / stylish.css
Last active March 26, 2021 02:21
Revert back to good old GitHub Homepage
/**
1. Install the Stylish(https://chrome.google.com/webstore/detail/stylish/fjnbnpbmkenffdnngjfgmeleoegfcffe?hl=en) extension for Chrome.
2. Open up extension options and paste the CSS mentioned below.
3. Specify the "URLs on the domain" to be `github.com`.
4. Add a title and save.
*/
.dashboard-sidebar {
float: right;
padding-right: 10px;
@avafloww
avafloww / PhpJava.java
Last active October 16, 2022 18:50
This snippet of code is syntactically valid in both PHP and Java, and produces the same output in both.
/*<?php
//*/public class PhpJava { public static void main(String[] args) { System.out.printf("/*%s",
//\u000A\u002F\u002A
class PhpJava {
static function main() {
echo(//\u000A\u002A\u002F
"Hello World!");
}}
//\u000A\u002F\u002A
PhpJava::main();
@madis
madis / gist:4650014
Created January 27, 2013 19:40
Testing CORS OPTIONS request with curl
curl \
--verbose \
--request OPTIONS \
http://localhost:3001/api/configuration/visitor \
--header 'Origin: http://localhost:9292' \
--header 'Access-Control-Request-Headers: Origin, Accept, Content-Type' \
--header 'Access-Control-Request-Method: GET'
# http://nils-blum-oeste.net/cors-api-with-oauth2-authentication-using-rails-and-angularjs/#.UQJeLkp4ZyE
@gustavohenke
gustavohenke / svg2png.js
Created February 18, 2014 15:27
SVG to PNG
var svg = document.querySelector( "svg" );
var svgData = new XMLSerializer().serializeToString( svg );
var canvas = document.createElement( "canvas" );
var ctx = canvas.getContext( "2d" );
var img = document.createElement( "img" );
img.setAttribute( "src", "data:image/svg+xml;base64," + btoa( svgData ) );
img.onload = function() {
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@rauchg
rauchg / README.md
Last active January 6, 2024 07:19
require-from-twitter
@imjasonh
imjasonh / markdown.css
Last active February 12, 2024 17:18
Render Markdown as unrendered Markdown (see http://jsbin.com/huwosomawo)
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}