Skip to content

Instantly share code, notes, and snippets.

View mhaley's full-sized avatar

Matthew Haley mhaley

View GitHub Profile
@mhaley
mhaley / dz60-v60emulated.js
Created July 16, 2018 04:29
QMK Configurator keymap for a DZ60 to emulate a V60. Includes toggle arrow key function. To use, visit https://config.qmk.fm/#/dz60/LAYOUT_60_ansi and choose Import Keymap.
{"keyboard":"dz60","keymap":"dz60-v60ish","layout":"LAYOUT_60_ansi","layers":[["KC_GESC","KC_1","KC_2","KC_3","KC_4","KC_5","KC_6","KC_7","KC_8","KC_9","KC_0","KC_MINS","KC_EQL","KC_BSPC","KC_TAB","KC_Q","KC_W","KC_E","KC_R","KC_T","KC_Y","KC_U","KC_I","KC_O","KC_P","KC_LBRC","KC_RBRC","KC_BSLS","KC_CAPS","KC_A","KC_S","KC_D","KC_F","KC_G","KC_H","KC_J","KC_K","KC_L","KC_SCLN","KC_QUOT","KC_ENT","KC_LSFT","KC_Z","KC_X","KC_C","KC_V","KC_B","KC_N","KC_M","KC_COMM","KC_DOT","KC_SLSH","KC_RSFT","KC_LCTL","KC_LGUI","KC_LALT","KC_SPC","MO(1)","KC_RGUI","KC_APP","KC_RCTL"],["KC_GRV","KC_F1","KC_F2","KC_F3","KC_F4","KC_F5","KC_F6","KC_F7","KC_F8","KC_F9","KC_F10","KC_F11","KC_F12","KC_DEL","KC_CAPS","KC_TRNS","KC_UP","KC_TRNS","KC_BSPC","KC_HOME","KC_PGUP","KC_PSCR","KC_SLCK","KC_PAUS","KC_UP","KC_TRNS","KC_TRNS","RESET","KC_TRNS","KC_LEFT","KC_DOWN","KC_RGHT","KC_DEL","KC_END","KC_PGDN","LSFT(KC_GRV)","KC_INS","KC_LEFT","KC_DOWN","KC_RGHT","TG(2)","KC_TRNS","RGB_TOG","RGB_MOD","RGB_HUI","RGB_HUD","RGB_SAI","RGB_SAD
@mhaley
mhaley / gist:1057539
Created June 30, 2011 23:26
Newton's Method
(z=proc{|a,x|(a*a-x).abs<1e-7?a:z[(a+(x/a))/2,x]})[1.0,4]
@mhaley
mhaley / TooFar.java
Created June 30, 2011 19:44
Newton's method of approximation to find square roots.
package net.smajnr;
public class TooFar {
public static void main(String[] args) {
System.out.format("The square root of %.0f is %.0f%n", 4.0, new Object() {
double sqrt(double x) {
return new Object() {
double sqrtIter(double guess, double x) {
if (new Object() {
boolean goodEnough(double guess, double x) {
package net.smajnr.brainfuck;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
public class BrainfuckSimpler {
private byte[] state = new byte[30000];
private int dp = 0;
# ...
require 'clearance/shoulda_macros'
RSpec.configure do |config|
# ...
# Include Shoulda macros for Clearance
config.include Clearance::Shoulda::Helpers
/* See LICENSE file for copyright and license details. */
/* appearance */
static const char font[] = "-misc-fixed-medium-r-normal-*-10-*-*-*-*-*-iso10646-*";
static const char normbordercolor[] = "#cccccc";
static const char normbgcolor[] = "#cccccc";
static const char normfgcolor[] = "#000000";
static const char selbordercolor[] = "#0066ff";
static const char selbgcolor[] = "#0066ff";
static const char selfgcolor[] = "#ffffff";
unless "".respond_to?(:ord)
class String
def ord
self[0].ord
end
end
end
class RC4
attr_accessor :s, :s2, :i, :j, :key
# http://www.centos.org/modules/newbb/viewtopic.php?topic_id=11510
ProxyRequests Off
<Proxy *>
Order deny,allow
# -- Place your other networks, if needed
# -- or change to "Allow from all", if you don't care
# Allow from 127.0.0.0/255.0.0.0 172.16.0.0/255.240.0.0 192.168
Allow from all
</Proxy>
@ECHO OFF
REM ####################################################################################################################
REM # Batch script for running PostgreSQL without having to install on Windows. #
REM # Thanks to http://www.postgresonline.com/journal/archives/172-Starting-PostgreSQL-in-windows-without-install.html #
REM ####################################################################################################################
REM Setup Variables
@SET PATH="%CD%\bin";%PATH%
@SET PGDATA=%CD%\data
@SET PGDATABASE=postgres
#!/bin/bash
# Load resources
xrdb -merge .Xresources
# Set up an icon tray
trayer --edge top --align right --SetDockType true --SetPartialStrut true \
--expand true --width 10 --transparent true --tint 0x191970 --height 12 &
# Set the background color