Skip to content

Instantly share code, notes, and snippets.

View scvnc's full-sized avatar

Vincent Schramer scvnc

View GitHub Profile
@scvnc
scvnc / evmini.uml
Created May 27, 2013 16:28
evmini draft of e-r diagram
@startuml
title
EVmini E-R diagram
Using CakePHP naming conventions.
endtitle
object candidacies {
id INT
@scvnc
scvnc / post
Created August 11, 2013 03:03
conceptual tutorial
"""
Demonstrating POST data with Mitchuation (through Flask)
"""
from flask import Flask
from flask import request
app = Flask(__name__)
@app.route('/')
@scvnc
scvnc / google-backup-code-tinfoil.py
Created September 15, 2013 18:31
Adds an extra layer of tinfoil to google's two-factor authentication backup. Google provides a list of security codes to log in to your account if you cannot obtain access to your device which satisfies two-factor authentication. They suggest to generate this code list and print them out to keep in your wallet or something of the like. This modu…
#!/usr/bin/env python
import re
def code_parser(file_text):
""" Returns a list (as numbers) of all the google security codes
found in a text file. """
codes = re.findall('[0-9]{3} [0-9]{2} [0-9]{3}', file_text)
@scvnc
scvnc / angular-js-unit-testing-example.js
Last active December 25, 2015 17:49
"It should have a working LoginService" is way to broad for a single test in my opinion. I think they should be broken out into individual tests so that when the tests fail you know exactly why. Referring to the unit test example in http://andyshora.com/unit-testing-best-practices-angularjs.html
// http://andyshora.com/unit-testing-best-practices-angularjs.html
// "It should have a working LoginService" is way to broad for a single behavior test in my opinion.
// I think they should be broken out into individual tests so that when the tests fail you know exactly why.
// CODE IS UNTESTED, only sketched out. It can be done this way.
describe('LoginService', function(){
describe('email validator', function(){
@scvnc
scvnc / nginx-node-forward
Last active January 3, 2016 19:59
This tells nginx to forward requests to an express application listening on 127.0.0.1:9005 when the requested hostname matches pub.webjcl.* This one rests in /etc/nginx/sites-available and is symlinked from /etc/nginx/sites-enabled.
# Define a server label which points to where we have node.js listening
upstream pub-webjcl {
server 127.0.0.1:9005;
}
server {
# Make site accessible from http://pub.webjcl.*
server_name pub.webjcl.*;
@scvnc
scvnc / test.rkt
Created March 2, 2014 02:30
Sum base-10 digits of number in racket
#lang racket
;; Racket is a trip
;; ASCI-Value minus 48
(define (parseDigit c)
(- (char->integer c) 48))
;; Sums a list of characters as integers
(define (addDigitString charList)
@scvnc
scvnc / Windows-USB-on-Linux.md
Last active August 2, 2016 02:23
Bootable Windows 7 USB Drive via LINUX

PROBLEM: ALL MY WINDOWS IMAGES ARE ON MY LINUX WORKSTATION AND I NEED TO BOOT WINDOWS OFF A USB DRIVE.

Historically, I've used Windows 7 USB/DVD Download tool on a Windows guest OS in VirtualBox to get this done. Well after doing the research and several stick formats later: I've pieced together a better recipe.

Some other solutions/tutorials have some shortcomings. WinUSB is too complicated and doesn't work with certain versions of GRUB. This post comes very close but assumes the drive has a Windows 7 bootloader already.

Make new partition table

Give the USB device one primary partition. This is what I did, other partitioning schemes may work. I'm using fdisk.

@scvnc
scvnc / cryptocurrency_report.py
Last active August 29, 2015 14:02
This pulls data from cryptocurrency sources and makes a report that I'm interested in. I currently have conky display the report.
#!/usr/bin/env python
from __future__ import print_function
"""
This pulls data from cryptocurrency sources and makes a report
that I'm interested in. I currently have conky display the report.
requirements:
pip install requests
@scvnc
scvnc / test.sh
Last active August 29, 2015 14:03
Bash file loop screenshare sesssion tutorial
for file in *.md; do
# Execute: basename ${file} ".md"
# and store the result in name
name=$(basename ${file} ".md")
# In bash, you can refer to variables like this:
# $name or ${name}. I prefer the latter because in this
# text-crazy scripting environment it can be useful to identify
# explicitly which pieces are variables.
@scvnc
scvnc / gist:f0dc7c2219838cfbc75f
Last active August 29, 2015 14:03
deltaG mfe brainstorm
class RNA_MFE_Calculator:
Sequence seq
BindSite[] bind_sites
float base_MFE()
float calcDeltaG(BindSite[])