Skip to content

Instantly share code, notes, and snippets.

@sigma
sigma / .emacs-local.el
Created April 19, 2009 09:03
.emacs-local.el
;; -*- mode: emacs-lisp; auto-compile-lisp: nil; -*-
;;;;;;;;;;;;;;;;;;;;;;;;
;; Name/Email settings
;;
(setq user-full-name "Firstname Lastname")
(setq user-mail-address "me@example.com")
(setq message-alternative-emails (rx "other.me@example.com"))
(setq home-directory (getenv "HOME"))
@ncweinhold
ncweinhold / main.c
Created May 25, 2011 20:44
Calling Gambit-C scheme functions from C
#include <stdio.h>
#define ___VERSION 406001
#include "gambit.h"
#include "somescheme.h"
#define SCHEME_LIBRARY_LINKER ____20_somescheme__
___BEGIN_C_LINKAGE
@fzaninotto
fzaninotto / gist:1308547
Created October 24, 2011 07:49
Inserting data to a database using Faker and PDO
<?php
$pdo = new PDO('mysql:host=hostname;dbname=defaultDbName', 'username', 'p@55w0rd');
$sql = 'INSERT INTO author (first_name, last_name, date_of_birth, email) VALUES (?, ?, ?, ?)';
$stmt = $pdo->prepare($sql);
$faker = \Faker\Factory::create();
$insertedPKs = array();
for ($i=0; $i < 100; $i++) {
$stmt->bindValue(1, $faker->firstName, PDO::PARAM_STR);
$stmt->bindValue(2, $faker->lastName, PDO::PARAM_STR);
$stmt->bindValue(1, $faker->date, PDO::PARAM_STR);
@ralphbean
ralphbean / ansiimages.py
Created October 31, 2011 13:48
ansi2html test
#!/usr/bin/env python
"""
The great test for ansi2html. Can it reliably reproduce images that have been
converted to ansi color by fabulous?
Before running this, install the following in a virtualenv::
$ pip install ansi2html fabulous PIL
Author: Ralph Bean -- http://threebean.org
@kjordahl
kjordahl / pudb-add-breakpoint
Created January 25, 2012 19:31
Emacs lisp code to add pudb breakpoint to a python file (add to .emacs)
;; this location is "~/.pudb-bp" in older versions of pudb
(setq pudb-bp-file (expand-file-name "~/.config/pudb/saved-breakpoints"))
(defun pudb-add-breakpoint ()
(interactive)
(append-to-file
(concat "b " buffer-file-name ":"
(nth 1 (split-string (what-line))) "\n")
nil pudb-bp-file))
(define-key py-mode-map (kbd "C-c C-t") 'pudb-add-breakpoint)
@mtmtcode
mtmtcode / auto-rsync.el
Last active September 2, 2022 00:30
auto-rsync.el - Emacs minor mode to execute rsync automaticlly
;;; auto-rsync-mode -- minor mode for auto rsync
;;
;; Author: @l3msh0
;;
;;; Example
;;
;; (require 'auto-rsync)
;; (auto-rsync-mode t)
;; (setq auto-rsync-dir-alist
@jpic
jpic / config.py
Created March 4, 2013 15:12
Dwm-like layout for Qtile ... feels like home ! welcome Qtile B)
class Master(SingleWindow):
defaults = [
("border_focus", "#ff0000", "Border colour for the focused window."),
("border_normal", "#000000", "Border colour for un-focused winows."),
("border_width", 2, "Border width."),
("name", "xmonad-tall", "Name of this layout."),
]
_min_ratio = .1
_max_ratio = .9
@Niriel
Niriel / gist:5311471
Created April 4, 2013 15:37
A Python implementation of Arrows (such as seen in Haskell).
#! /usr/bin/python
"""Implementation of the arrow abstraction for functions.
Abstracting functions with Arrows has advantages. Arrows make it very easy to
compose functions (by simply 'multiplying' them with the `*` operator). The
order in which the arrows are written match the order of the computations,
making long pipelines easy to work with. Arrows also provide mechanisms for
creating and merging branches, which helps when a value needs to be consumed by
several functions, or when a function needs values from several sources. Arrows
can also support conditional application, selecting which of two functions f and
@jasonrudolph
jasonrudolph / 00-about-search-api-examples.md
Last active April 30, 2024 19:21
5 entertaining things you can find with the GitHub Search API
@jimweirich
jimweirich / eternal_flame.sng
Created August 8, 2013 05:59
Words/Chords to the Eternal Flame
The Eternal Flame (God Wrote in Lisp)
Bob Kanefsky / Julia Ecklar
F G C
I was taught assembler in my second year of school.
F G C
It's kinda like construction work, with a toothpick for a tool.
F G C Em Am
So when I made my senior year, I threw my code away,