Skip to content

Instantly share code, notes, and snippets.

View orderthruchaos's full-sized avatar

Brett DiFrischia orderthruchaos

View GitHub Profile
@statico
statico / gist:3172711
Created July 24, 2012 21:15
How to use a PS3 controller on Mac OS X 10.7 (Lion)

How to use a PS3 controller on Mac OS X 10.7 (Lion)

  1. Open Apple menu -> System Preferences -> Bluetooth and disable Bluetooth on Mac as well as any other nearby Macs or devices which will try to pair with and confuse the controller.

  2. Reset PS3 controller by inserting paperclip into pinhole near L2 button.

  3. Connect PS3 controller to Mac with USB cable.

  4. Enable Bluetooth.

@swannodette
swannodette / gist:3217582
Created July 31, 2012 14:52
sudoku_compact.clj
;; based on core.logic 0.8-alpha2 or core.logic master branch
(ns sudoku
(:refer-clojure :exclude [==])
(:use clojure.core.logic))
(defn get-square [rows x y]
(for [x (range x (+ x 3))
y (range y (+ y 3))]
(get-in rows [x y])))
@paulcc
paulcc / gist:3733182
Created September 16, 2012 16:51
Code for the Word Chain kata, see the October edition of PragPub magazine
-- word list is at https://gist.github.com/3799331
import Data.Set(Set, fromDistinctAscList, member)
import System.IO.Unsafe(unsafePerformIO)
import Data.Tree
import Data.List(inits,tails)
--------------------
-- first step - generating valid next words
@paulcc
paulcc / gist:3799331
Created September 28, 2012 11:43
list of four-letter words to go with https://gist.github.com/3733182
aahs
abbe
abbr
abed
abet
able
ably
abut
acct
aced
@snoyberg
snoyberg / Jqplot.hs
Created October 3, 2012 22:02
Create a reusable widget for jqplot
{-# LANGUAGE OverloadedStrings, TemplateHaskell, RecordWildCards #-}
-- | We're going to provide a module that provides a pure-Haskell interface to
-- the jqplot library. To use it, you don't need to write any HTML, CSS, or
-- Javascript in your code, as we'll see in our example app.
--
-- The idea is that all of the low-level Javascript code goes in this module,
-- and apps just deal with the widget.
--
-- Note that, for simplicity, we're only implementing a tiny subset of jqPlot's
--- client.c.orig 2013-06-02 15:29:03.175177500 -0500
+++ client.c 2013-06-02 15:32:59.124455900 -0500
@@ -328,8 +328,12 @@
strlcpy(data.term, term, sizeof data.term) >= sizeof data.term)
*data.term = '\0';
+#ifdef __CYGWIN__
+ snprintf(&data.ttyname, sizeof(data.ttyname), "%s", ttyname(STDIN_FILENO));
+#else
if ((fd = dup(STDIN_FILENO)) == -1)
@sasa1977
sasa1977 / xmerl_demo.ex
Last active July 26, 2023 10:07
Simple xmerl usage demo in Elixir
defmodule XmlNode do
require Record
Record.defrecord :xmlAttribute, Record.extract(:xmlAttribute, from_lib: "xmerl/include/xmerl.hrl")
Record.defrecord :xmlText, Record.extract(:xmlText, from_lib: "xmerl/include/xmerl.hrl")
def from_string(xml_string, options \\ [quiet: true]) do
{doc, []} =
xml_string
|> :binary.bin_to_list
|> :xmerl_scan.string(options)
@mwhite
mwhite / git-aliases.md
Last active September 28, 2025 02:50
The Ultimate Git Alias Setup

The Ultimate Git Alias Setup

If you use git on the command-line, you'll eventually find yourself wanting aliases for your most commonly-used commands. It's incredibly useful to be able to explore your repos with only a few keystrokes that eventually get hardcoded into muscle memory.

Some people don't add aliases because they don't want to have to adjust to not having them on a remote server. Personally, I find that having aliases doesn't mean I that forget the underlying commands, and aliases provide such a massive improvement to my workflow that it would be crazy not to have them.

The simplest way to add an alias for a specific git command is to use a standard bash alias.

# .bashrc
@jfreeze
jfreeze / gist:9423233
Created March 8, 2014 00:34
Installing Elixir on Raspberry Pi
My quick notes on what I did to install Elixir on the Raspberry Pi.
All the info is here, but it's a self guided tour.
# Get Raspbian
http://www.raspberrypi.org/downloads
http://downloads.raspberrypi.org/raspbian_latest
# Copy raspbian.img file to th SD Card
diskutils unmountDisk /dev/disk<numberhere>
@deepakkumarnd
deepakkumarnd / server_setup.sh
Last active October 8, 2024 00:49
Server setup script
# This script has to be run as a root user
echo "* Updating system"
apt-get update
apt-get -y upgrade
echo "* Installing packages"
apt-get -y install build-essential libmagickcore-dev imagemagick libmagickwand-dev libxml2-dev libxslt1-dev git-core nginx redis-server curl nodejs htop
id -u deploy &> /dev/null
if [ $? -ne 0 ]