Skip to content

Instantly share code, notes, and snippets.

View exterm's full-sized avatar

Philip Theus (prev. Mueller) exterm

View GitHub Profile
(let [stop (atom false)]
(repl :read (fn [rprompt rexit]
(if @stop rexit
(do (swap! stop (fn [_] true))
`(do (ignore-protocol-version nil)
(start-server "/tmp/slime-port.txt"
:encoding "iso-latin-1-unix"
:port ~port)))))
:need-prompt #(identity false)))
(defn eval
"Evaluates the form data structure (not text!) and returns the result."
[form] (. clojure.lang.Compiler (eval form)))
public static Object eval(Object form) throws Exception{
boolean createdLoader = false;
if(true)//!LOADER.isBound())
{
Var.pushThreadBindings(RT.map(LOADER, RT.makeClassLoader()));
createdLoader = true;
}
try
{
if(form instanceof IPersistentCollection
@exterm
exterm / sumgitachievements.sh
Created October 29, 2011 08:58 — forked from axelerator/sumgitachievements.sh
sum of all git achievement levels
git achievements -l | grep '(Level' | sed 's/.*(Level \([0-9]*\)).*/ \1 /g' | tr "\n" '+' | sed 's/$/ 0/' | xargs expr
@exterm
exterm / PKGBUILD
Created October 30, 2011 21:09
xfce4-hdaps PKGBUILD
# Maintainer: Pethe Milan <[email protected]>
pkgname=xfce4-hdaps
pkgver=0.0.7
pkgrel=1
pkgdesc="A plugin to indicate the status of the IBM Hard Drive Active Protection System, or HDAPS."
arch=(i686 x86_64)
license=('GPL')
url="http://michael.orlitzky.com/code/xfce4-hdaps.php"
depends=('tp_smapi' 'linux')
makedepends=('pkgconfig')
@exterm
exterm / Xorg.0.log
Created March 19, 2012 13:20
problem with arch startup
[ 19.863]
X.Org X Server 1.12.0
Release Date: 2012-03-04
[ 19.863] X Protocol Version 11, Revision 0
[ 19.863] Build Operating System: Linux 3.2.9-1-ARCH i686
[ 19.863] Current Operating System: Linux t41 3.2.11-1-ARCH #1 SMP PREEMPT Thu Mar 15 09:16:03 UTC 2012 i686
[ 19.863] Kernel command line: root=/dev/disk/by-label/linux_root ro
[ 19.863] Build Date: 05 March 2012 06:02:28AM
[ 19.863]
[ 19.863] Current version of pixman: 0.24.4
@exterm
exterm / rebar.config
Created March 22, 2012 17:29
rebar configuration
% documentation for rebar.config: https://github.com/basho/rebar/blob/master/rebar.config.sample
{sub_dirs, ["launcher", "disco"]}.
{erl_opts, [debug_info, fail_on_warning, parse_transform, lager_transform]}.
{require_otp_vsn, "R14"}.
{deps,
[lager,
@exterm
exterm / gist:2160644
Created March 22, 2012 17:39
project layout
.
├── deps
│ └── lager
├── disco
│ ├── ebin
│ └── src
├── launcher
│ ├── ebin
│ └── src
├── main.config
@exterm
exterm / mystery.rb
Created July 26, 2012 08:08
Clean Code.
def nb_lines(width, text)
text = "" if text.nil?
cw = @CurrentFont['cw']
width = @w - @rMargin - @x if (width == 0)
wmax = (width - 2 * @cMargin) * 1000 / @FontSize
s = text.gsub("\r", '')
nb = s.length
nb -= 1 if nb > 0 && s[nb-1] == "\n"
sep = -1
i, j, l = 0, 0, 0
@exterm
exterm / Decoupling.hs
Last active December 10, 2015 19:39
Showing that a function that depends only on a single attribute of a map like data structure is also possible with static records/structs. This allows adding/removing attributes from the record without modification of the all_members function.
data Project = Project {
projId :: String,
projKind :: ProjectKind,
projDescription :: String,
projBudget :: Int,
projTeam :: [Person]
}
all_members :: [Project] -> [Person]
all_members projects = concat $ map projTeam projects