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
jack in /U/j/p/a/maintenance_scripts on master [!] | |
$ python sat6_report.py | |
Traceback (most recent call last): | |
File "sat6_report.py", line 6, in <module> | |
import requests | |
ImportError: No module named requests | |
jack in /U/j/p/a/maintenance_scripts on master [!] | |
$ pip list | grep requests | |
requests 2.10.0 |
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
/* | |
* @author Jack Bracken | |
* DFA to recognise the regular expression (0|1 0* 1 0* 1)* | |
* using enums. | |
*/ | |
interface State { | |
public State next(Token word); | |
} |
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
#!/usr/bin/env ruby | |
# The naive approach | |
input = "R5, R4, R2, L3, R1, R1, L4, L5, R3, L1, L1, R4, L2, R1, R4, R4, L2, L2, R4, L4, R1, R3, L3, L1, L2, R1, R5, L5, L1, L1, R3, R5, L1, R4, L5, R5, R1, L185, R4, L1, R51, R3, L2, R78, R1, L4, R188, R1, L5, R5, R2, R3, L5, R3, R4, L1, R2, R2, L4, L4, L5, R5, R4, L4, R2, L5, R2, L1, L4, R4, L4, R2, L3, L4, R2, L3, R3, R2, L2, L3, R4, R3, R1, L4, L2, L5, R4, R4, L1, R1, L5, L1, R3, R1, L2, R1, R1, R3, L4, L1, L3, R2, R4, R2, L2, R1, L5, R3, L3, R3, L1, R4, L3, L3, R4, L2, L1, L3, R2, R3, L2, L1, R4, L3, L5, L2, L4, R1, L4, L4, R3, R5, L4, L1, L1, R4, L2, R5, R1, R1, R2, R1, R5, L1, L3, L5, R2".split(', ') | |
dist = hor = ver = 0 | |
facing = :north | |
def turn(facing, dir) |
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
#!/usr/bin/env bash | |
# Ask for the administrator password upfront. | |
sudo -v | |
# Keep-alive: update existing `sudo` time stamp until the script has finished. | |
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & | |
# Install xcode command line tools | |
xcode-select --install |
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
class CreateSomeModel < ActiveRecord::Migration | |
create_table :some_model do |t| | |
# SomeModel :active should always default to false | |
t.boolean :active, null: false, default: false | |
end | |
end | |
class SomeModel < ActiveRecord::Base | |
# But Model scope will override it | |
default_scope{ where(active: true) } |
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
function krisKindle() { | |
"use strict"; | |
var peopleInKrisKindle, bag, key, giver,firstGiver, receiver, sendMail; | |
sendMail = function(giver, receiver) { | |
var email = peopleInKrisKindle[giver], | |
subject = "Secret Santa", | |
message = "You have to get a gift for " + receiver; | |
MailApp.sendEmail(email, subject, message); | |
}; | |
peopleInKrisKindle = { |
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
require 'net/http' | |
require 'json' | |
require 'uri' | |
class GitHub < Plugin | |
def help(plugin, topic="") | |
"Github plugin, print information about github user" | |
end |
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 authenticate_user_from_token! | |
user_token = request.headers['Auth-Token'].presence || params[:auth_token].presence || nil | |
user = user_token && User.find_by_authentication_token(user_token.to_s) | |
if user | |
@current_user = user | |
end | |
end |
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
[~]$ cat Test.java | |
public class Test { | |
private int i; | |
public int getI() { | |
return i; | |
} | |
public static void main(String[] args) { | |
Test t = new Test(); | |
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
[~]$ javac Test.java | |
Test.java:4: error: variable i might not have been initialized | |
System.out.print(i); | |
^ | |
1 error | |
[~]$ cat Test.java | |
public class Test { | |
public static void main(String[] args) { | |
int i; | |
System.out.print(i); |
NewerOlder