This file contains hidden or 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
return map.map(function(column_str) { | |
var col = column_str.split(""), | |
y = col.length; | |
while(y >= 0) { | |
if (col[y] == 'o' && col[y + 1] === '.') { | |
col[y + 1] = col[y]; | |
col[y] = '.'; | |
y++; | |
} else y--; |
This file contains hidden or 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
from flask import Flask | |
app = Flask(__name__) | |
from . import views |
This file contains hidden or 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 time | |
from threading import Thread, Event | |
import Queue | |
from flask import Flask, request | |
class LoopThread(Thread): | |
def __init__(self, stop_event, interrupt_queue): | |
self.stop_event = stop_event | |
self.interrupt_queue = interrupt_queue | |
Thread.__init__(self) |
This file contains hidden or 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
// Problem 1 | |
function forSum(arr) { | |
var sum = 0, i; | |
for(i = 0; i < arr.length; arr++) { | |
sum += arr[i]; | |
} | |
return sum | |
} | |
function whileSum(arr) { | |
var sum = 0, i = arr.length; |
This file contains hidden or 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
#lang racket | |
(require xml net/url) | |
(define (serve port-no) | |
(define main-cust (make-custodian)) | |
(parameterize ([current-custodian main-cust]) | |
(define listener (tcp-listen port-no 5 #t)) | |
(define (loop) | |
(accept-and-handle listener) | |
(loop)) |
This file contains hidden or 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
from flask import Flask | |
from socialext import SocialExtension | |
app = Flask(__name__) | |
social = SocialExtension(app) | |
@app.route('/') | |
def index(): | |
return render_template_string(""" |
This file contains hidden or 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
var async = require("async"); | |
var AWS = require("aws-sdk"); | |
var gm = require("gm").subClass({imageMagick: true}); | |
var fs = require("fs"); | |
var mktemp = require("mktemp"); | |
var THUMB_KEY_PREFIX = "thumbnails/", | |
THUMB_WIDTH = 150, | |
THUMB_HEIGHT = 150, | |
ALLOWED_FILETYPES = ['png', 'jpg', 'jpeg', 'bmp', 'tiff', 'pdf', 'gif']; |
This file contains hidden or 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
#!/usr/bin/env python2 | |
import boto | |
from collections import defaultdict | |
from pprint import pprint | |
import os, sys | |
DIVIDER = """ | |
=========================================== | |
======== ec2-instances ======== |
This file contains hidden or 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
[02/17/15 23:44:56] [INFO] Reading configuration file /home/frank/.ngrok | |
[02/17/15 23:44:56] [INFO] [client] Trusting root CAs: [assets/client/tls/ngrokroot.crt] | |
[02/17/15 23:44:56] [INFO] [view] [web] Serving web interface on 0.0.0.0:8888 | |
[02/17/15 23:44:56] [INFO] Checking for update | |
[02/17/15 23:44:56] [DEBG] [ctl:374737d0] New connection to: 96.126.125.171:443 | |
[02/17/15 23:44:56] [DEBG] [ctl:374737d0] Writing message: {"Type":"Auth","Payload":{"Version":"2","MmVersion":"1.7","User":"ZnDxl31mzAgxJhgAb7Tc","Password":"","OS":"linux","Arch":"amd64","ClientId":""}} | |
[02/17/15 23:44:56] [DEBG] [ctl:374737d0] Waiting to read message | |
[02/17/15 23:44:57] [DEBG] [ctl:374737d0] Reading message with length: 120 | |
[02/17/15 23:44:57] [DEBG] [ctl:374737d0] Read message {"Type":"AuthResp","Payload":{"Version":"2","MmVersion":"1.7","ClientId":"03f700f2df0a3bc9f2bc5e74606ea8b6","Error":""}} | |
[02/17/15 23:44:57] [INFO] [client] Authenticated with server, client id: 03f700f2df0a3bc9f2bc5e74606ea8b6 |
This file contains hidden or 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
echo Setting OSX values for Virtual Box ${1} | |
VBoxManage modifyvm "${1}" --cpuidset 00000001 000306a9 04100800 7fbae3ff bfebfbff | |
VBoxManage setextradata "${1}" "VBoxInternal/Devices/efi/0/Config/DmiSystemProduct" "MacBookPro11,3" | |
VBoxManage setextradata "${1}" "VBoxInternal/Devices/efi/0/Config/DmiSystemVersion" "1.0" | |
VBoxManage setextradata "${1}" "VBoxInternal/Devices/efi/0/Config/DmiBoardProduct" "Iloveapple" | |
VBoxManage setextradata "${1}" "VBoxInternal/Devices/smc/0/Config/DeviceKey" "ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc" | |
VBoxManage setextradata "${1}" "VBoxInternal/Devices/smc/0/Config/GetKeyFromRealSMC" 1 |