Skip to content

Instantly share code, notes, and snippets.

Avatar

Chris Rebert cvrebert

View GitHub Profile
@cvrebert
cvrebert / auto_twitchplayspokemon.js
Created Feb 17, 2014
Automatic participant for TwitchPlaysPokemon
View auto_twitchplayspokemon.js
// This is super-hacky since it's 2am.
function press(button) {
$("#chat_text_input").val(button);
$('#chat_speak').click();
}
var silence = false;
var xPos = 0;
var yPos = 0;
var aaa = 0;
View gist:4b321000df6c9772a014
### package.json
{
"devDependencies": {
"grunt": "^0.4.5",
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-less": "^1.0.0",
"load-grunt-tasks": "^3.1.0"
}
}
@cvrebert
cvrebert / Main.java
Created Apr 14, 2015
Trying to get createdAt of an MkComment throws IllegalStateException
View Main.java
import java.io.IOException;
import java.util.Date;
import com.jcabi.github.*;
import com.jcabi.github.mock.*;
public class Main {
public static void main(String[] args) throws IOException {
Github gh = new MkGithub("mock_gh");
Comment cmt = gh
.repos().create(javax.json.Json.createObjectBuilder().add("name", "foobar").build())
@cvrebert
cvrebert / Main.java
Created Apr 13, 2015
jcabi MkGithub example code no longer compiles
View Main.java
package qux;
import java.io.IOException;
import com.jcabi.github.*;
import com.jcabi.github.mock.*;
public class Main {
public static void main(String[] args) {
Github github = null;
try {
@cvrebert
cvrebert / npm-ls.txt
Created Apr 26, 2015
npm-shrinkwrap portion of `npm ls`
View npm-ls.txt
bootstrap@3.3.4 /Users/chris/code/bootstrap
├─┬ npm-shrinkwrap@200.4.0
│ ├── array-find@0.1.1
│ ├─┬ error@4.4.0
│ │ ├── camelize@1.0.0
│ │ └── xtend@4.0.0
│ ├─┬ json-diff@0.3.1
│ │ ├─┬ cli-color@0.1.7
│ │ │ └── es5-ext@0.8.2
│ │ ├─┬ difflib@0.2.4
View gist:c8575aced21ff59901f6
Index: appe.xml
===================================================================
--- appe.xml (revision 2813)
+++ appe.xml (working copy)
@@ -8,7 +8,7 @@
bugs. They're still good instructions, and are referenced from <xref
linkend="users-to-volunteers"/><phrase output="printed"> in <xref
linkend="managing-volunteers"/></phrase>. But as they are a living
-document, I felt it didn't make sense to include a frozen snaphot of
+document, I felt it didn't make sense to include a frozen snapshot of
@cvrebert
cvrebert / dist-files.log
Created Jun 16, 2015
bootstrap v3.3.5 and bower
View dist-files.log
$ bower install bootstrap
bower bootstrap#* not-cached git://github.com/twbs/bootstrap.git#*
bower bootstrap#* resolve git://github.com/twbs/bootstrap.git#*
bower bootstrap#* download https://github.com/twbs/bootstrap/archive/v3.3.5.tar.gz
bower bootstrap#* progress received 2.9MB of 3.1MB downloaded, 94%
bower bootstrap#* extract archive.tar.gz
bower bootstrap#* resolved git://github.com/twbs/bootstrap.git#3.3.5
bower jquery#>= 1.9.1 cached git://github.com/jquery/jquery.git#2.1.4
bower jquery#>= 1.9.1 validate 2.1.4 against git://github.com/jquery/jquery.git#>= 1.9.1
bower bootstrap#~3.3.5 install bootstrap#3.3.5
@cvrebert
cvrebert / gist:e453cf70678c7dce5a83
Created Aug 3, 2015
bootstrap-sass #941 counterexample
View gist:e453cf70678c7dce5a83
$ npm install bower grunt grunt-contrib-sass
<snipped successful installation>
$ ./node_modules/.bin/bower install bootstrap-sass
bower bootstrap-sass#* cached git://github.com/twbs/bootstrap-sass.git#3.3.4
bower bootstrap-sass#* validate 3.3.4 against git://github.com/twbs/bootstrap-sass.git#*
bower bootstrap-sass#* new version for git://github.com/twbs/bootstrap-sass.git#*
bower bootstrap-sass#* resolve git://github.com/twbs/bootstrap-sass.git#*
bower bootstrap-sass#* download https://github.com/twbs/bootstrap-sass/archive/v3.3.5.tar.gz
bower bootstrap-sass#* extract archive.tar.gz
bower bootstrap-sass#* resolved git://github.com/twbs/bootstrap-sass.git#3.3.5
@cvrebert
cvrebert / balls_in_numbered_boxes_CVR.py
Created Sep 11, 2011
Refactored "recursive algorithm for balls in numbered boxes"
View balls_in_numbered_boxes_CVR.py
def balls_in_numbered_boxes(balls, box_sizes):
if not isinstance(balls, int):
raise TypeError("balls must be a non-negative integer.")
if balls < 0:
raise ValueError("balls must be a non-negative integer.")
box_sizes = list(box_sizes)
if not box_sizes:
raise ValueError("box_sizes must be a non-empty iterable.")
@cvrebert
cvrebert / pokecrack.py
Created Jan 19, 2012
So, I took CSE 127...
View pokecrack.py
#!/usr/bin/env python
# Background: http://cses.ucsd.edu/pokemon/ & http://cseweb.ucsd.edu/classes/fa11/cse127-a/
from urllib import urlopen, urlencode
url = "http://cses.ucsd.edu/pokemon/submitemail.php"
for n in range(1, 1000):
data = urlencode({"email":"YourUsernameHere@ucsd.edu", "pokemonid":str(n), "submit":"Catch!"})
f = urlopen(url, data)
result = f.read()
f.close()
print(result) # if you want
You can’t perform that action at this time.