This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto.ec2 | |
import sys | |
import datetime | |
from time import gmtime, strftime, sleep | |
import toml | |
# expects ec2 instance tag: power-off | |
# values should be in 24hr clock from:to | |
# eg 2400:0400 | |
# would result in midnight to 4am |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto.ec2 | |
import sys | |
def get_snaps (desc, vol,conn): | |
snapshots = conn.get_all_snapshots(owner='id...', | |
filters={'description':'*'+desc+'*'}) | |
return snapshots | |
def op_snaps (vols,max_snaps,conn): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def clients (atom {})) | |
(defn remove-client [ch] (close ch)(swap! clients dissoc ch)) | |
(defn purge-clients! [] | |
(doseq [c @clients] | |
(if (> (- (.getTime (java.util.Date.)) (.getTime (:last-seen (val c)))) 60000) | |
(remove-client (key c))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// .. // | |
static VERT_SRC: &'static str = r" | |
#version 140 | |
in vec3 pos; | |
in vec3 norm; | |
uniform mat4 transform; | |
uniform vec3 size; | |
uniform vec3 color; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;uses core.async and refers chan, >!, go, alts!! and timeout functions | |
(def c (chan)) | |
(go (>! c {:msg "hi"})) | |
(defn peek! [ch & args] | |
"quickly looks at a channel for new incoming data, pulls it if it exists, quits otherwise; | |
returns seq if specifying max elements to pull" | |
(if-not (nil? args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; (ns somenamespace | |
;; (:refer-clojure :exclude [* - + == /]) | |
;; (:use clojure.core.matrix) | |
;; (:use clojure.core.matrix.operators) | |
;; (:gen-class)) | |
(defn inv [n] "returns the inverse, (* -1 n)" (* -1 n)) | |
(defn projection [l r b t, n f, aspect fov] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// toml parser and config for keybindings, etc. | |
use toml::{Parser,Value}; | |
use std::fs::File; | |
use std::io::Read; | |
use glium::glutin::VirtualKeyCode; | |
use std::collections::{HashMap,BTreeMap}; | |
#[derive(Debug)] | |
pub struct Bindings(HashMap<String,VirtualKeyCode>); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defentity INFORMATION_SCHEMA.tables) | |
(def tables (map #(get % :TABLE_NAME) | |
(select 'INFORMATION_SCHEMA.tables (fields :TABLE_NAME) | |
(where {:TABLE_TYPE "BASE TABLE"})))) ;notice the quote | |
(prn tables) | |
;(map #(def %) tables) ;additional concept | |
(map #(defentity %) tables) ;not sure this is required anymore | |
(select (first tables)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(set 'nitemode nil) | |
(defun toggle-nitemode () | |
"toggles nitemode" | |
(interactive) | |
(cond ((not nitemode) | |
(load-theme 'solarized-dark t) | |
(set 'nitemode 1)) | |
((eq 1 nitemode) | |
(load-theme 'solarized-light t) | |
(set 'nitemode nil)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(core)] | |
extern crate core; | |
use self::core::num::Int; | |
fn rng<T:PartialEq+Int, F:FnMut(T)> (d:T,dt:T,mut f:F) { | |
if d>dt { for n in (dt..d).rev() { f(n); } } | |
else { for n in (d..dt) { f(n); } } | |
} | |
fn main () { |