Skip to content

Instantly share code, notes, and snippets.

@cathcart
cathcart / tmux.conf
Created October 29, 2017 13:35
my tmux conf
# https://github.com/seebi/tmux-colors-solarized/blob/master/tmuxcolors-256.conf
set-option -g status-bg colour235 #base02
set-option -g status-fg colour136 #yellow
set-option -g status-attr default
# set window split
bind-key h split-window -v
bind-key v split-window -h
# default window title colors
@cathcart
cathcart / Dockerfile
Created June 1, 2015 15:42
Dockerfile for a mono based docker image of Jackett
FROM mono:latest
RUN apt-get update
RUN apt-get -y -q install git
RUN apt-get -y -q install libcurl4-openssl-dev
RUN git clone https://github.com/zone117x/Jackett.git
RUN apt-get remove -y --auto-remove git
WORKDIR /Jackett/src
RUN mkdir packages
WORKDIR /Jackett/src/packages
@cathcart
cathcart / weasel.clj
Created April 5, 2012 15:47 — forked from maxcountryman/weasel.clj
Weasel in Clojure
;; weasel
(def TARGET "ME THINKS IT IS LIKE A WEASEL")
(def ALPHABET "ABCDEFGHIJKLMNOPQRSTUVWXYZ ")
(def RATE 0.05)
(def rand-seed
"Generate a random seed as long as the target."
(take (count TARGET) (repeatedly #(rand-nth ALPHABET))))
@cathcart
cathcart / gist:2038085
Created March 14, 2012 17:31
unholy mess
fburp
@cathcart
cathcart / siesta
Created October 28, 2011 12:38
siesta module
import subprocess
import os
import shutil
import glob
def list_variables():
return [x.split() for x in open("VARS").read().strip().split("\n")]
def new_input_file(parameters,var_names,file_name):
if len(parameters) != len(var_names):
@cathcart
cathcart / swarm.py
Created October 21, 2011 16:47
PSO
import random
class Vector:
def __class__(self):
return "Vector"
def __init__(self, data):
self.data = data
def __repr__(self):
return repr(self.data)
def __add__(self, other):
data = []
#import modules python 2.5* and scipy and atlas
from scipy.integrate import quad
from math import log
from math import exp
from numpy import inf
def func_inner(y):
return (1-exp(-y))/y
def int_inner(x):
@cathcart
cathcart / Simplex.py
Created August 30, 2011 16:44 — forked from redacted/Simplex.py
Simplex algorithm in Python (c) 2001 Vivake Gupta, retrieved from archive.org
#!/usr/bin/env python
#
# Copyright (c) 2001 Vivake Gupta (vivakeATomniscia.org). All rights reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
#! /bin/bash
for i in $(ls *-sp-*.txt); do
echo $i
sp=$(echo $i|awk '{gsub(/.txt/,"")gsub(/mA/,"");print}'|awk 'BEGIN{FS = "-" }{for (i=3; i<NF+1; i++){print $i}}')
OUTFILE=$(basename $i .txt)
t=2
PLOT="p '$i' u 1:$t w l title \"$(echo $sp|awk '{print $1}') mA\" "
#echo $PLOT
line=$(echo $sp|awk '{print $1}')
@cathcart
cathcart / makefile
Created May 5, 2011 17:28 — forked from redacted/makefile
One Make to rule them all...
# get platform
uname_ans=$(shell uname)
ifeq ($(uname_ans), Darwin)
# on a Mac, can use clang/llvm
# much better diagnostics, slightly slower code
cc=clang
else
# fall back to gcc
cc=gcc