Skip to content

Instantly share code, notes, and snippets.

Caffeinating from Home

Jesse Donat donatj

Caffeinating from Home
View GitHub Profile
oranj / apache_fetch.php
Created May 15, 2012
Apache Open Directory Fetch
View apache_fetch.php
if (! isset($argv[1])) {
fputs(STDERR, "Please provide a URL to crawl\n");
if (! isset($argv[2])) {
fputs(STDERR, "Please provide an output filename\n");
mreid /
Last active Jul 21, 2019
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".
# EXAMPLE (from lectures):
# $ python abbababbababbab
# (0,a)
donatj / ColorCLI.php
Created Oct 26, 2011
Simple CLI color class
View ColorCLI.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',
avafloww /
Last active Dec 4, 2020
This snippet of code is syntactically valid in both PHP and Java, and produces the same output in both.
//*/public class PhpJava { public static void main(String[] args) { System.out.printf("/*%s",
class PhpJava {
static function main() {
"Hello World!");
rauchg /
Last active Feb 19, 2021
amitmerchant1990 / stylish.css
Last active Mar 26, 2021
Revert back to good old GitHub Homepage
View stylish.css
1. Install the Stylish( extension for Chrome.
2. Open up extension options and paste the CSS mentioned below.
3. Specify the "URLs on the domain" to be ``.
4. Add a title and save.
.dashboard-sidebar {
float: right;
padding-right: 10px;

Blurry font issue with Wine 2.0 on macOS 10.12.2

After installing the latest Wine release, which currently is 2.0 (I chose the development branch) on XQuartz 2.7.11, I was having problems with blurry text in both winecfg, regedit and other programs launched through Wine. After trying to enable font smoothing and font replacements (source) with only slight changes I found someone trying to solve the same issues (source), albeit compiling everything from scratch which I don't want to do. It turns out that the Retina display on my MacBook Pro was causing the issues with blurry fonts because Wine was not using the "real" resolution, only the reported "lower resolution".

To enable Retina support in Wine open the registry editor via a terminal, preferably through Wine installed with Wine:
$ wine regedit

Then find the folder/key:

View svg2png.js
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() {
imjasonh / markdown.css
Last active Jun 10, 2021
Render Markdown as unrendered Markdown (see
View markdown.css
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
madis / gist:4650014
Created Jan 27, 2013
Testing CORS OPTIONS request with curl
View gist:4650014
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'