Skip to content

Instantly share code, notes, and snippets.

⌨️
Clicking away on my new Model M. It's a lovely sound.

Jay Williams jaywilliams

Block or report user

Report or block jaywilliams

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jaywilliams
jaywilliams / install-mosh.sh
Last active May 24, 2019 — forked from palexander/gist:2975305
Compiling and running mosh on Dreamhost (Updated - 2018)
View install-mosh.sh
#!/usr/bin/env bash
# Thanks to @samsonjs for the cleaned up version:
# https://gist.github.com/samsonjs/4076746
PREFIX=$HOME/local
VERSION=1.3.2
# Create Source Directory
mkdir -p $PREFIX/src
@jaywilliams
jaywilliams / csv_to_array.php
Created Apr 30, 2010
Convert a comma separated file into an associated array.
View csv_to_array.php
<?php
/**
* Convert a comma separated file into an associated array.
* The first row should contain the array keys.
*
* Example:
*
* @param string $filename Path to the CSV file
* @param string $delimiter The separator used in the file
* @return array
@jaywilliams
jaywilliams / convert.php
Last active May 4, 2019
# Convert a QuickBooks QBXML Report to HTML/CSV File # I created this little script to help me read through the raw XML responses from QuickBooks. I originally built it to export to a CSV file, but found that a simple HTML table was better suited for my usage. However, I've included the CSV code below for anyone who may need that functionality. …
View convert.php
<?php
/**
* Convert a QuickBooks QBXML Report to HTML/CSV File
*
* I created this little script to help me read through the raw XML responses
* from QuickBooks. I originally built it to export to a CSV file, but found
* that a simple HTML table was better suited for my usage. However, I've
* included the CSV code below for anyone who may need that functionality.
*
@jaywilliams
jaywilliams / searchd
Last active Jan 9, 2019
A working OpenBSD Sphinx Search rc.d init script
View searchd
#!/bin/ksh
#
# searchd - Sphinxsearch network daemon
#
# Use --nodetach flag in combination with rc_bg to workaround searchd not
# listening on specified network ports
daemon="/usr/local/bin/searchd"
daemon_flags="--nodetach"
# daemon_user="www"
View highdpi.md

See Also: https://wiki.archlinux.org/index.php/Xorg#Setting_DPI_manually

Setting DPI manually Note: While you can set any dpi you like and applications using Qt and GTK will scale accordingly, it's recommended to set it to 96, 120 (25% higher), 144 (50% higher), 168 (75% higher), 192 (100% higher) etc., to reduce scaling artifacts to GUI that use bitmaps. Reducing it below 96 dpi may not reduce size of graphical elements of GUI as typically the lowest dpi the icons are made for is 96.

# The bang exclamation is used for comments in the Xresources file
nano $HOME/.Xresources
------------------------------------------------
!Xft.dpi: 96
@jaywilliams
jaywilliams / Twilight Terminal Theme.mdown
Created Aug 1, 2012
Twilight Theme Terminal Colors
View Twilight Terminal Theme.mdown

Twilight Theme Terminal Colors

Based on the timeless TextMate theme.

Basic Colors

Foreground:     #FEFFD3
Background:     #141414
@jaywilliams
jaywilliams / convert_ascii.php
Created May 28, 2009
This simple function will remove any non-ASCII character. Feel free to fork and extend!
View convert_ascii.php
<?php
/**
* Remove any non-ASCII characters and convert known non-ASCII characters
* to their ASCII equivalents, if possible.
*
* @param string $string
* @return string $string
* @author Jay Williams <myd3.com>
* @license MIT License
* @link http://gist.github.com/119517
@jaywilliams
jaywilliams / array_to_object.php
Created Dec 16, 2009
Convert a multi-dimensional array into a stdClass object. Pass by reference.
View array_to_object.php
<?php
/**
* Convert a multi-dimensional array into a stdClass object.
*
* Example:
* $values = array('hello'=>'world');
*
* // Convert the array to an object
* array_to_object($values);
*
@jaywilliams
jaywilliams / .htaccess
Last active Jun 7, 2018
Magento 2 SSL Redirect Loop Fix (Apache + Varnish + Nginx)
View .htaccess
# Add this to your the Magento .htaccess file located in your docroot
############################################
## Nginx proxy HTTPS Fix for Magento
## Source: https://www.sonassi.com/blog/magento-kb/magento-https-redirect-loop-2
SetEnvIf X-Forwarded-Proto https HTTPS=on
View test_php_skill.php
<?php
/*****************************************
* Created this test for job interviews. *
*****************************************/
/**
* Directions
*
* Read the direction in the Q and respond below A.
You can’t perform that action at this time.