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 __future__ import print_function | |
| from flask import Flask | |
| from functools import wraps | |
| import json | |
| import sys | |
| app = Flask(__name__) | |
| def example_wrapper(f): | |
| print(f.func_dict) |
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 subprocess | |
| import sys | |
| try: | |
| policy = subprocess.check_output(['apt-cache', 'policy', 'python-dev']) | |
| if 'Installed: (none)' in policy: | |
| print("ERROR: no python dev package installed") | |
| print("Please run: sudo apt-get install python-dev") | |
| sys.exit(1) | |
| except OSError: |
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
| <?php | |
| define('PASSWD_SALT_LENGTH', 16); | |
| define('PASSWD_HASH_ALGORITHM', 'sha512'); | |
| define('SALT_LENGTH', 16); | |
| function passwordCrypt($password) { | |
| $saltSource = fopen('/dev/random', 'rb'); | |
| $saltData = bin2hex(fread($saltSource, PASSWD_SALT_LENGTH)); | |
| fclose($saltSource); |
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
| {-# LANGUAGE GADTs #-} | |
| module StateAutoConversion(fromAutomaton, toAutomaton, StateResult(StateResult)) where | |
| import Prelude hiding (id, (.)) | |
| import Control.Category | |
| import Control.Arrow | |
| import Control.Arrow.Transformer |
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
| #!/bin/bash | |
| # Usage: review-ws (gerrit change number) when in an srweb clone | |
| SSH_HOST=badger | |
| set -e | |
| REF=$(ssh $SSH_HOST gerrit query --current-patch-set $1 | grep '^ ref: ' | cut -d' ' -f6) | |
| git fetch https://www.studentrobotics.org/gerrit/srweb $REF | |
| git checkout FETCH_HEAD | |
| FILES=$(git diff --name-only HEAD~1 HEAD | grep '^content/en') | |
| for FILE in $FILES | |
| do |
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
| formats = {} | |
| formats['vanilla'] = {'player_join': '(?P<name>[A-Za-z0-9_]{1,16}) has joined the game\.'} | |
| formats['bukkit'] = {'plugin_loading': '\[(?P<plugin_name>.+\] plugin loaded\.'} | |
| formats['ping_1.6'] = {...} | |
| # Select which combinations to use, taking right-to-left precedence | |
| options = ['ping_1.6', 'vanilla'] | |
| messages = dict(itertools.chain.from_iterable(formats[x].items() for x in options)) |
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
| {-# LANGUAGE GeneralizedNewtypeDeriving, MultiParamTypeClasses, FunctionalDependencies, FlexibleInstances, RankNTypes, MonadComprehensions, TupleSections #-} | |
| import Control.Applicative | |
| import Data.Monoid | |
| import Control.Monad | |
| import Control.Monad.Cont | |
| import Control.Concurrent.MVar | |
| import Data.IORef | |
| newtype SignalIn m a = SignalIn (Cont (m ()) a) |
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
| Ponies. |
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
| #!/bin/sh | |
| mkdir /tmp/robot-bee | |
| cp -R $1 /tmp/robot-bee/robot.zip | |
| pushd /tmp/robot-bee | |
| unzip robot.zip | |
| rm robot.zip | |
| rm -rf user/.git | |
| find user -name '*.pyc' | xargs rm | |
| rm -rf user/.gitignore | |
| rm -rf user/.gitattributes |
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
| for (var i = 0; i < obj["userids"].length; i++) { | |
| (function(userid) { | |
| $.get("user/" + userid, {"token":token}, function(resp, userid) { | |
| var user_name = JSON.parse(resp)["full_name"]; | |
| build += "<li><a class='user' id='user-" + userid + "' href='#show-" + userid + "'>" + user_name + "</a></li>"; | |
| remaining -= 1; | |
| if (remaining == 0) { | |
| make_users_list(obj, build); | |
| hide_spinner(); | |
| $("#login").hide(); |