Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/python2
from tabulate import tabulate
from random import random
from math import floor
DAYS = 7
SECTIONS = 10
MAX_TTR = 6 # minutes -> max time to read
MIN_TTR = 2
import bpy
from math import pi
## Create a set of keyframes for Suzanne using Blender python
bpy.ops.graph.interpolation_type(type="CUBIC")
suzie = bpy.data.objects['Suzanne']
# Each keyframe is (frame, location, rotation, scale)
@naphthalene
naphthalene / Makefile
Last active August 29, 2015 14:18
Berkeley AI [all projects] Makefile
# Author: Pasha Sadikov <pashalab at gmail dot com>
# USAGE:
# Create a directory for each project with the code provided in the
# assignment.
# $ make PA0 # To make the tutorial; PA1, 2, 3 etc. for the other
# # projects
# CONFIGURE your USERNAME here
@naphthalene
naphthalene / Makefile
Created April 2, 2015 16:19
Berkeley AI [all projects] Makefile
# Author: Pasha Sadikov <pashalab at gmail dot com>
# USAGE:
# Create a directory for each project with the code provided in the
# assignment.
# $ make PA0 # To make the tutorial; PA1, 2, 3 etc. for the other
# # projects
# CONFIGURE your USERNAME here
var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;
var SUITS = ["H", "D", "S", "C"];
var CARDS = ["2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A"];
var RANKS = ["HC", "1P", "2P", "3K", "ST", "FL", "FH", "4K", "SF", "RF"];
@naphthalene
naphthalene / mpdfifo
Created July 12, 2015 20:12
MPD FM Radio Init Script
#!/bin/bash
### BEGIN INIT INFO
# Provides: mpdfifo
# Required-Start: pulseaudio mpd
# Default-Start: 2 3 4 5
# Short-Description: MPD FM radio broadcasting
### END INIT INFO
# Author: Pavel Sadikov <pashalab@gmail.com>
# To use, run `sudo xboxdrv -c xboxrl.conf`
# NOTE:
# I've customized some keyboard bindings in Rocket League to make this work better:
# Drive forwards: U
# Drive backwards: J
# Barrel Roll: LeftShift
# Jump: Space
# Boost: Enter
# Toggle Camera: q
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1
mQENBFR/o94BCADH6sNU/yxjfVJb7eHRyFg+++TOTCn9BLrwHmvdl9VBbD1WP7zy
wrf0DiWav9HIeP9PSMr0vswqgW072TDdH/UZ8cNkTu4d3Z8SCyVjhmRpNbiCoaD9
qqjkBJYIxNHM9X/K73PQgM09xAwiZ79TvFO6AXdW3wsAHF9XZvMM86PbLKZSSjoO
DkhmnqA/bwF39mgkJhIN234sdwp1NIppfWtXTlGmJ50VGVL+UgB8T0MR3xDhbOi+
HSRDGQQbEuAuuChiPU5xylqMS6kR0C9kqFAUeOfk7o8jmMTakRd7FXPaXrIHqznZ
J44eplfEbAnqBMN6V+ZLS5A9ynRbFildFg3fABEBAAG0LFBhdmVsIFNhZGlrb3Yg
KHRzaWdzdHkpIDxwYXNoYWxhYkBnbWFpbC5jb20+iQE+BBMBAgAoBQJUf6PeAhsD
efetch -db protein "ybfE" -format gpc -mode xml | xtract -insd complete CDS coded_by | awk '{match($0,"([A-Z0-9\\.]+)\\t([A-Z0-9\\.]+):([0-9]+)\\.\\.([0-9]+)",a)}END{print a[1], a[2], a[3], a[4]}' | tee output.txt
#!/bin/bash
set -f
IFS=$'\n'
esearch -db protein -query "ybfE" |\
efetch -format gpc -mode xml |\
xtract -insd complete CDS coded_by > query_results.txt
for i in $(cat query_results.txt);
do echo "$i" | awk '{match($0,"([A-Z0-9\\.]+)\\s+(complement\\()?([A-Z0-9\\.]+):([0-9]+)\\.\\.([0-9]+)(\\))?",a)}END{print a[1], a[3], a[4], a[5]}'
done