Skip to content

Instantly share code, notes, and snippets.

View orther's full-sized avatar
🏠
Working from home

Brandon Orther orther

🏠
Working from home
View GitHub Profile
@orther
orther / mad-jobs.sh
Created April 9, 2014 09:04
Linux jobs command for parallel processing
# Wait on all child jobs.
function wait_jobs () {
for PID in $(jobs -p); do
notice "Waiting on pid $PID"
wait $PID
done
}
#hdmi_group=2
#hdmi_mode=47
gpu_mem=128
#start_file=start_x.elf
#fixup_file=fixup_x.dat
start_x=1
@orther
orther / gist:e305aa4a69f551c390a2
Created July 23, 2014 02:19
SQLAlchemy Argument and Example

This is from a facebood post Mehmet Ali 'mali' Akmanalp. These are two comments written by Mehmet Ali 'mali' Akmanalp:

Matt: so with SQLAlchemy the point is that the ORM is laid on top of this lower level SQL generator, so when the ORM is too specific and you need to fall back, you don't have to concatenate strings and you can generate syntactically correct and safe SQL through code. Check it: http://docs.sqlalchemy.org/en/rel_0_9/core/tutorial.html (scroll down for cooler examples).

Matt: let me give you an example from what I'm working on now. So let's say you have a generic query for fetching monthly aggregated import / export values between countries. Sometimes you want to filter by one country. Sometimes you want to filter by 10 countries. Sometimes you want to use the column containing the inflation-adjusted value instead of the regular column. Sometimes you want the average export instead of the total export.

With a low level abstraction layer, I can do stuff like already_complicated_query.fi

{
"data": {
"name": "Brandon",
"age": 32
}
}
(def ops
{"+" +
"-" -
"*" *
":" /})
;; calc request handler and proof the app's in clojure jerk
(defn calc [req]
(let [a (Integer. (get-in req [:route-params :a]))
b (Integer. (get-in req [:route-params :b]))
(ns webdev.core
(:require [ring.adapter.jetty :as jetty]
[ring.middleware.reload :refer [wrap-reload]]
[compojure.core :refer [defroutes GET]]
[compojure.route :refer [not-found]]
[ring.handler.dump :refer [handle-dump]]))
(defn about [req]
{:status 200
:body "My name is Brandon Orther. I am following along with LispCast's Intro to Web Development with Clojure."
@orther
orther / sitelink-soap-test.py
Created April 30, 2015 00:13
Basic test of SOAPpy connection to SiteLink's API (NOTE: I threw this together after soap2py failed on diffgram)
@orther
orther / instructions.md
Created May 1, 2015 16:54
How to backup entire GitHub Organization including repo, wiki and issues.
  1. Create access token for your github user with read rights to org.
  2. Install github-backup pip install github-backup
  3. github-backup -t --all -O -P --prefer-ssh
#!/bin/sh
export FIRST_LINE=0
export LAST_LINE=0
sleep 1
sed -i'' "$FIRST_LINE,$LAST_LINE s/^/#/" /root/Dropbox/PSA_All_Check
sleep 2
#!/bin/bash
#Comment Test
#Comment Test
#Comment Test
#Comment Test
#Comment Test
export FIRST_LINE=0
export LAST_LINE=0