Skip to content

Instantly share code, notes, and snippets.

@sellout
sellout / color-theme-solarized.el
Created March 26, 2011 13:48
First step of a Solarized color theme for Emacs (http://ethanschoonover.com/solarized)
(eval-when-compile
(require 'color-theme))
(defun color-theme-solarized (mode)
"Color theme by Ethan Schoonover, created 2011-03-24.
Ported to Emacs by Greg Pfeil, http://ethanschoonover.com/solarized."
(interactive "Slight or dark? ")
(let ((base03 "#002b36")
(base02 "#073642")
(base01 "#586e75")
@baali
baali / MajorClust.py
Last active May 28, 2016 05:16
MajorClust algorithm implementation using sklearn based on SO conversation about text clustering using python(http://stackoverflow.com/questions/1789254/clustering-text-in-python).
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.pairwise import linear_kernel
import numpy as np
from itertools import combinations
from random import shuffle
def majorclust_sklearn():
texts = [
"foo blub baz",
"foo bar baz",
@edrex
edrex / camlistore-server-vps-s3.md
Last active June 8, 2016 10:12
Camlistore on a VPS with S3 blob storage

Let's set up Camlistore on a Linux server, with blobs stored in s3. This seems to be the currently best-supported option for "cloud" deployment.

This is meant as a supplement to the official server config doc. Read through both docs before you start.

http://camlistore.org/docs/server-config

This blog post is also recommended reading.

I've posted my config files for reference, but they will be created the first time you run camlistored (for the server) and camput init (for the client) so don't copy them.

@hypernumbers
hypernumbers / New Years Resolution - Learn eLisp For Emacs
Created December 24, 2010 23:38
Why not learn eLisp for Emacs in 2011?
Interested in learning eLisp for Emacs, ever thought you should?
I wanted to learn eLisp but there are no decent beginners' book - so I decided to write one - and by decent I mean super-basic starting assuming you know nothing at all.
It is my 'official' side-project; something to work on when I am bored or blocked in my main work.
You can see how much progress I have made here:
http://learn-elisp-for-emacs.org/
The book will get written quicker if other people muck in.
@zzgvh
zzgvh / restricted_user_projects_by_org.py
Created August 8, 2018 11:50
Alternative project access restriction model
class RestrictedUserProjectsByOrg(models.Model):
user = models.OneToOneField('User', related_name='restricted_projects')
organisation = models.ForeignKey('Organisation', related_name='restricted_users')
is_restricted = models.BooleanField(default=False) #do we need this?
restricted_projects = models.ManyToManyField(
'Project', related_name='inaccessible_by', null=True, blank=True)
"""
Descriptions of events and pseudo code. One question I haven't thought through is multiple employments
by both user and admin
@dmedvinsky
dmedvinsky / xwrits-lock-hooks.diff
Created September 1, 2010 10:10
Adds ability to execute sh scripts in xwrits before lock and after unlock.
diff -u xwrits-2.26//main.c xwrits/main.c
--- xwrits-2.26//main.c 2009-04-04 01:17:02.000000000 +0400
+++ xwrits/main.c 2010-09-01 14:06:52.531052264 +0400
@@ -10,6 +10,7 @@
#ifdef HAVE_XINERAMA
#include <X11/extensions/Xinerama.h>
#endif
+#include <signal.h>
static Options onormal;
@zflat
zflat / pg_migrate_steps.sh
Last active March 17, 2022 04:51
Migrate pg dump from Heroku to local sqlite3 development (and beyond)
# Export the Heroku PG database to a local dump file
# https://devcenter.heroku.com/articles/heroku-postgres-import-export#export
heroku pgbackups:capture
curl -o latest.dump `heroku pgbackups:url`
# Install postregs & Setup password
# https://help.ubuntu.com/community/PostgreSQL
# List databases
sudo -u postgres psql -l
@brianhuey
brianhuey / sports_scheduling.py
Last active July 24, 2022 11:03
My Python implementation of a sports scheduling example using Google's Operations Research tool. This may be useful to you if you are trying to work through the google-or documentation since it is written for C# and there are a number of differences. The original code: https://github.com/google/or-tools/blob/master/examples/cpp/sports_scheduling.cc
from ortools.constraint_solver import pywrapcp
# Python Implementation of
# https://github.com/google/or-tools/blob/master/examples/cpp/sports_scheduling.cc
# By Brian Huey
# Sports scheduling problem.
#
# We want to solve the problem of scheduling of team matches in a
# double round robin tournament. Given a number of teams, we want
# each team to encounter all other teams, twice, once at home, and
# once away. Furthermore, you cannot meet the same team twice in the
@dbuenzli
dbuenzli / ocaml-emacs.md
Last active August 11, 2022 00:39
Emacs setup for ocaml

Install the following opam packages:

opam install caml-mode merlin ocp-indent

Tweak your .emacs file with some or all of the following:

; shift tab to complete
(global-set-key (kbd "S-<tab>") 'company-complete)
@hiway
hiway / ssh-keygen.py
Last active October 28, 2022 21:17
Streamlit Demo - WebUI to generate/access SSH key-pairs for hosts.
from pathlib import Path
from typing import List
import pyperclip
import streamlit as st
from plumbum import local
SSH_KEYS_DIR = "~/.ssh/keys"
# --- API ---