Skip to content

Instantly share code, notes, and snippets.

🔛

James J Porter porterjamesj

🔛
Block or report user

Report or block porterjamesj

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@porterjamesj
porterjamesj / numba.pip.log
Created Mar 20, 2013
complete pip log of failed numba install
View numba.pip.log
------------------------------------------------------------
/Users/james/.virtualenvs/numbatest/bin/pip run on Wed Mar 20 12:56:47 2013
Downloading/unpacking numba
Getting page http://pypi.python.org/simple/numba
URLs to search for versions for numba:
* http://pypi.python.org/simple/numba/
Getting page http://numba.github.com
Getting page http://numba.pydata.org
Getting page https://numba.github.com
View gist:6076205
#!/usr/bin/python
# -*- coding: utf-8 -*-
from flask import Flask
from flaskext.sqlalchemy import SQLAlchemy
from werkzeug.security import generate_password_hash
from werkzeug.security import check_password_hash
from sqlalchemy.orm.exc import NoResultFound
app = Flask(__name__)
@porterjamesj
porterjamesj / trolling.el
Created Jul 30, 2013
Emacs Trolling — Make the buffer position a random number
View trolling.el
(setcar mode-line-position '(:eval (number-to-string (random))))
View mutability.jl
julia> a = function(x)
x[1] = 0
end
# function
julia> x = [3,3]
2-element Int64 Array:
3
3
@porterjamesj
porterjamesj / julianagram.jl
Last active Dec 21, 2015
longest anagram finder in julia
View julianagram.jl
function doit(f::IOStream)
wordmap = Dict{Array{Char},Array{Char}}()
best = (0,"","")
for line in eachline(f)
if length(line) > best[1]
word = collect(line)
cannonical = sort(word)
if haskey(wordmap,cannonical)
best = (length(word),word,wordmap[cannonical])
@porterjamesj
porterjamesj / venv-macros.el
Created Sep 17, 2013
two macros that both produce the correct result
View venv-macros.el
;; needed for both
(defun venv--gen-fun (command)
`(defun ,(intern (format "pcomplete/eshell-mode/%s" command)) ()
(pcomplete-here* (venv-get-candidates))))
;; with the common lisp loop macro
(defmacro venv--make-pcompletions (commands)
`(progn ,@(loop for item in commands
collect (venv--gen-fun item))))
@porterjamesj
porterjamesj / FauxO.py
Last active Dec 23, 2015
fooling around with some FauxO tooling
View FauxO.py
from functools import wraps
from copy import deepcopy
def fauxothis(fn):
@wraps(fn)
def wrapper(self):
new = deepcopy(self)
fn(new)
return new
@porterjamesj
porterjamesj / heapsort.c
Created Sep 22, 2013
quick heapsort implementation
View heapsort.c
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
/* Heap struct (just an array and its length). */
typedef struct {
int *slots;
int len;
} heap_base_t, *heap_t;
@porterjamesj
porterjamesj / silly.s
Last active Dec 24, 2015
silly mips program that works as expected in spim
View silly.s
main:
addi $sp $sp -4 # allocate space for one thing on the stack
addi $t0 $zero 30
sw $t0 4($sp)
addi $t1 $sp 4 # put the address we want in t1
lw $t1 0($t1) # <- this works, 30 ends up in $t1
# exit syscall
li $v0 10 # system call code for exit = 10
syscall # call operating sys
@porterjamesj
porterjamesj / mom log
Created Oct 10, 2013 — forked from anonymous/20131009
mom log from failed torque run
View mom log
10/09/2013 12:33:34;0002; pbs_mom.1199;Svr;Log;Log opened
10/09/2013 12:33:34;0002; pbs_mom.1199;Svr;pbs_mom;Torque Mom Version = 4.1.5, loglevel = 0
10/09/2013 12:33:34;0002; pbs_mom.1200;Svr;setpbsserver;torque-headnode-63079663-10-09-13
10/09/2013 12:33:34;0002; pbs_mom.1200;Svr;mom_server_add;server torque-headnode-63079663-10-09-13 added
10/09/2013 12:33:34;0002; pbs_mom.1200;Svr;usecp;*:/glusterfs/users /glusterfs/users
10/09/2013 12:33:34;0002; pbs_mom.1200;Svr;setloglevel;4
10/09/2013 12:33:34;0002; pbs_mom.1200;n/a;initialize;independent
10/09/2013 12:33:34;0080; pbs_mom.1200;Svr;pbs_mom;before init_abort_jobs
10/09/2013 12:33:34;0002; pbs_mom.1200;Svr;pbs_mom;Is up
10/09/2013 12:33:34;0002; pbs_mom.1200;Svr;setup_program_environment;MOM executable path and mtime at launch: /usr/local/sbin/pbs_mom 1363720006
You can’t perform that action at this time.