Skip to content

Instantly share code, notes, and snippets.

@semperos
semperos / Makefile
Last active August 29, 2015 14:20
Minimal, essential Makefile
CXXFLAGS=-std=c++11 -g -Wall -Werror
LDFLAGS=-g
LDLIBS=-lcurl
# LDLIBS = `pkg-config --libs libcurl`
TARGET ?= mysql-manager
# SOURCES=mysql-manager.cpp
# OBJECTS=$(subst .cpp,.o,$(SOURCES))
RM=rm -f
@semperos
semperos / keybase.md
Created April 2, 2015 20:02
keybase.md

Keybase proof

I hereby claim:

  • I am semperos on github.
  • I am semperos (https://keybase.io/semperos) on keybase.
  • I have a public key whose fingerprint is 1672 7790 04C2 1915 6688 FD23 1245 ADCE E539 FEAE

To claim this, I am signing this object:

@semperos
semperos / nodejs-server.clj
Created December 31, 2014 17:20
NodeJS Server "Hello, World" at ClojureScript REPL
;; David Nolen announced NodeJS REPL support for ClojureScript: http://swannodette.github.io/2014/12/29/nodejs-of-my-dreams/
;; This is a short interactive session that implements the NodeJS server "Hello, World",
;; featured on the NodeJS home page: http://nodejs.org/#column1
;; At command-line:
;; git clone https://github.com/clojure/clojurescript
;; cd clojurescript
;; ./script/bootstrap
;; ./script/self-compile
;; npm install source-map-support
@semperos
semperos / vars-in-fns.clj
Created November 4, 2014 17:43
Var's in fn's
#_user=> (defn init [] (def foo 42) (def bar 21))
;=> #'user/init
#_user=> (ns new-ns (:require user))
;=> nil
#_new-ns=> (user/init)
;=> #'user/bar
#_new-ns=> foo
; CompilerException java.lang.RuntimeException: Unable to resolve symbol: foo in this context, compiling:(/private/var/folders/nv/qqtdn92n2hzb30fp95xytks80000gp/T/form-init2636843255245152689.clj:1:4154)
#_new-ns=> bar
!function(){function n(n,t){return t>n?-1:n>t?1:n>=t?0:0/0}function t(n){return null!=n&&!isNaN(n)}function e(n){return{left:function(t,e,r,u){for(arguments.length<3&&(r=0),arguments.length<4&&(u=t.length);u>r;){var i=r+u>>>1;n(t[i],e)<0?r=i+1:u=i}return r},right:function(t,e,r,u){for(arguments.length<3&&(r=0),arguments.length<4&&(u=t.length);u>r;){var i=r+u>>>1;n(t[i],e)>0?u=i:r=i+1}return r}}}function r(n){return n.length}function u(n){for(var t=1;n*t%1;)t*=10;return t}function i(n,t){try{for(var e in t)Object.defineProperty(n.prototype,e,{value:t[e],enumerable:!1})}catch(r){n.prototype=t}}function o(){}function a(n){return ha+n in this}function c(n){return n=ha+n,n in this&&delete this[n]}function s(){var n=[];return this.forEach(function(t){n.push(t)}),n}function l(){var n=0;for(var t in this)t.charCodeAt(0)===ga&&++n;return n}function f(){for(var n in this)if(n.charCodeAt(0)===ga)return!1;return!0}function h(){}function g(n,t,e){return function(){var r=e.apply(t,arguments);return r===t?n:r}}function p(n,
@semperos
semperos / .vimrc
Created May 15, 2014 21:11
spf13 Defaults
" Modeline and Notes {
" vim: set sw=4 ts=4 sts=4 et tw=78 foldmarker={,} foldlevel=0 foldmethod=marker spell:
"
" __ _ _____ _
" ___ _ __ / _/ |___ / __ __(_)_ __ ___
" / __| '_ \| |_| | |_ \ _____\ \ / /| | '_ ` _ \
" \__ \ |_) | _| |___) |_____|\ V / | | | | | | |
" |___/ .__/|_| |_|____/ \_/ |_|_| |_| |_|
" |_|
"
@semperos
semperos / d3.js
Created May 7, 2014 02:00
D3 Source
!function() {
var d3 = {
version: "3.4.6"
};
if (!Date.now) Date.now = function() {
return +new Date();
};
var d3_arraySlice = [].slice, d3_array = function(list) {
return d3_arraySlice.call(list);
};
@semperos
semperos / .screenrc
Created April 29, 2014 12:27
Screen Config
hardstatus alwayslastline '%{= G}[ %{G}%H %{g}][%= %{= w}%?%-Lw%?%{= R}%n*%f %t%?%{= R}(%u)%?%{= w}%+Lw%?%= %{= g}][%{B}%Y-%m-%d %{W}%c:%s %{g}]'
@semperos
semperos / config.bash
Created March 14, 2014 17:14
Java6 and Java7 on Mac OSX 10.8.5
##############
# Java Setup #
##############
# VERSIONS #
# Apple-supported JDK 6
export JAVA_6_HOME=$(/usr/libexec/java_home -v 1.6)
# Oracle JDK 7
export JAVA_7_HOME=$(/usr/libexec/java_home -v 1.7)
@semperos
semperos / SizeOf.java
Last active December 30, 2015 19:49 — forked from bnyeggen/SizeOf.java
import java.lang.reflect.*;
//This is still basically an estimate, but should be reasonably accurate.
public class SizeOf {
//4 bytes on 32 bit JVM
public static final int REFERENCE_SIZE = 8;
public static int deepSize(boolean b) { return 1; }
public static int deepSize(byte b) { return 1; }
public static int deepSize(char c) { return 2; }