Skip to content

Instantly share code, notes, and snippets.

View Terkwood's full-sized avatar
🦑

Terkwood Terkwood

🦑
  • Salesforce
  • Indiana, USA
  • 03:21 (UTC -04:00)
View GitHub Profile
@jamis
jamis / recursive-backtracker2.rb
Created December 27, 2010 04:36
An implementation of the recursive backtracking algorithm that *gasp* actually uses recursion.
# --------------------------------------------------------------------
# Recursive backtracking algorithm for maze generation. Requires that
# the entire maze be stored in memory, but is quite fast, easy to
# learn and implement, and (with a few tweaks) gives fairly good mazes.
# Can also be customized in a variety of ways.
# --------------------------------------------------------------------
# --------------------------------------------------------------------
# 1. Allow the maze to be customized via command-line parameters
# --------------------------------------------------------------------
@wheresalice
wheresalice / gist:883191
Created March 23, 2011 14:36
Arduino Redis client - pushes a message to a Redis list
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192, 168, 2, 10 }; // this is the ip within my lan
byte gateway[] = { 192, 168, 2, 254 }; // neccessary to get access to the internet via your router
byte subnet[] = { 255, 255, 255, 0 };
byte server[] = { 192, 168, 2, 50 }; // Redis Server
String list = "jobs";
String message = "hello world";
@danking
danking / gist:1068185
Created July 6, 2011 19:55
A very simple example showing how to use Racket's lexing and parsing utilities
#lang racket
(require parser-tools/lex
(prefix-in re- parser-tools/lex-sre)
parser-tools/yacc)
(provide (all-defined-out))
(define-tokens a (NUM VAR))
(define-empty-tokens b (+ - EOF LET IN))
(define-lex-trans number
(syntax-rules ()
@bradmontgomery
bradmontgomery / dummy-web-server.py
Last active May 28, 2024 15:02
a minimal http server in python. Responds to GET, HEAD, POST requests, but will fail on anything else.
#!/usr/bin/env python
"""
Very simple HTTP server in python (Updated for Python 3.7)
Usage:
./dummy-web-server.py -h
./dummy-web-server.py -l localhost -p 8000
Send a GET request:
@hoegertn
hoegertn / init script
Created September 14, 2012 21:07
stunnel init script
#!/bin/sh
#
# stunnel Start/Stop the stunnel daemons
#
# description: stunnel is a script that runs stunnel daemons
# version 1.00
#
# chkconfig: 345 40 60
#
# processname: stunnel
@rubencaro
rubencaro / install_elixir.md
Last active September 30, 2023 03:58
Elixir installation guide

Elixir installation guide

Version numbers should be the ones you want. Here I do it with the last ones available at the moment of writing.

The simplest way to install elixir is using your package manager. Sadly, at the time of writing only Fedora shows the intention to keep its packages up to date. There you can simply sudo dnf install erlang elixir and you are good to go.

Anyway, if you intend to work with several versions of erlang or elixir at the same time, or you are tied to a specific version, you will need to compile it yourself. Then asdf is your best friend.

@ArtemGr
ArtemGr / system.rs
Last active December 22, 2023 07:08
Read lines from a pipe as soon as they come out (useful for filtering).
#![feature(mpsc_select, box_syntax)]
use std::io;
use std::process::Command;
use std::sync::mpsc::{channel, Receiver, Select};
use std::string::FromUtf8Error;
use std::thread::spawn;
#[derive(Debug)]
enum PipeError {
@chrismccord
chrismccord / gist:31340f08d62de1457454
Last active August 8, 2021 17:10
Phoenix Content Negotiation
# Controller option 1, implicit render selected based on format
defmodule MyApp.UserController do
use Phoenix.Controller
def show(conn, %{"id" => id}) do
render conn, :show, user: Repo.get(User, id)
end
end
# Controller option 2, explicit render with format pattern match
@subfuzion
subfuzion / global-gitignore.md
Last active May 29, 2024 12:00
Global gitignore

There are certain files created by particular editors, IDEs, operating systems, etc., that do not belong in a repository. But adding system-specific files to the repo's .gitignore is considered a poor practice. This file should only exclude files and directories that are a part of the package that should not be versioned (such as the node_modules directory) as well as files that are generated (and regenerated) as artifacts of a build process.

All other files should be in your own global gitignore file:

  • Create a file called .gitignore in your home directory and add any filepath patterns you want to ignore.
  • Tell git where your global gitignore file is.

Note: The specific name and path you choose aren't important as long as you configure git to find it, as shown below. You could substitute .config/git/ignore for .gitignore in your home directory, if you prefer.

@tomaka
tomaka / gist:623781c5af6ebbc5dcfe
Last active February 15, 2020 06:24
Gfx vs glium comparison table
Gfx and glium are Rust libraries that aim to provide a "rusty" abstraction over graphics programming APIs.
Both may look similar, and one of the questions that gets asked frequently on IRC is "what are the differences between gfx and glium?". Here is a comparison table:
| Gfx | Glium
-------------------------------------|-------------------------------------------------------------------------------------------------------------------|--------------------------------
URL | <https://github.com/gfx-rs/gfx-rs> | <https://github.com/tomaka/glium>
History | Papers since Oct 2013. Really started in June 2014. | Private/confidential from Feb 201