Skip to content

Instantly share code, notes, and snippets.

View Bachmann1234's full-sized avatar

Matt Bachmann Bachmann1234

View GitHub Profile
@Bachmann1234
Bachmann1234 / Output
Last active March 26, 2018 16:17
Christmas Unicode!
billy gets 🎁
jill gets 💩
Jen gets 🎁
@Bachmann1234
Bachmann1234 / bad.py
Created December 20, 2014 01:21
Holy hell python
def C():
return "bat"
def С():
return "man"
if __name__ == "__main__":
print(C(), С())
@Bachmann1234
Bachmann1234 / List.py
Last active August 29, 2015 14:11
Fib playground
def is_fib(candidate, known_fibs=[0,1]):
last_fib = known_fibs[-1]
if candidate == last_fib:
return "IsFibo"
elif candidate < last_fib:
return "IsNotFibo"
else:
next_fib = last_fib + known_fibs[-2]
new_fibs = known_fibs + [next_fib]
return is_fib(candidate, known_fibs=new_fibs)
@Bachmann1234
Bachmann1234 / Test.java
Created December 18, 2014 20:03
Statically initialized map
import java.util.HashMap;
import java.util.Map;
public class Test {
public static void main(String[] args) {
Map<Integer, String> tens = new HashMap<Integer, String>(){{
put(10, "ten");
put(20, "twenty");
put(30, "thirty");
put(40, "fourty");
put(50, "fifty");
@Bachmann1234
Bachmann1234 / Post.py
Last active August 29, 2015 14:11
PostToPR
from github import Github
token = '<Token>'
pr_number = 1126
g = Github(token)
repo = g.get_repo('<Repo>')
pr = repo.get_pull(pr_number)
with open('diff-cover.txt') as f:
pr.create_issue_comment(f.read())
@Bachmann1234
Bachmann1234 / summarize3.py
Last active August 29, 2015 14:11
Summarize Python3
#!/usr/bin/env python3
import os
import urllib
import urllib.request
import sys
import re
import json
TITLE = "title"
@Bachmann1234
Bachmann1234 / summarize.py
Last active August 29, 2015 14:10
Summarize articles
#!/usr/bin/env python
from __future__ import unicode_literals, print_function
import os
import urllib
import urllib2
import sys
import re
import json
TITLE = "title"
@Bachmann1234
Bachmann1234 / Output
Last active August 29, 2015 14:09
Functools example. Create a basetwo function
[18, 91, 15]
@Bachmann1234
Bachmann1234 / gist:cd8e692b9435492b669f
Created October 23, 2014 17:47
this.py (from the python source)
s = """Gur Mra bs Clguba, ol Gvz Crgref
Ornhgvshy vf orggre guna htyl.
Rkcyvpvg vf orggre guna vzcyvpvg.
Fvzcyr vf orggre guna pbzcyrk.
Pbzcyrk vf orggre guna pbzcyvpngrq.
Syng vf orggre guna arfgrq.
Fcnefr vf orggre guna qrafr.
Ernqnovyvgl pbhagf.
Fcrpvny pnfrf nera'g fcrpvny rabhtu gb oernx gur ehyrf.
<?xml version="1.0" ?>
<!DOCTYPE coverage
SYSTEM 'http://cobertura.sourceforge.net/xml/coverage-03.dtd'>
<coverage branch-rate="0" line-rate="1" timestamp="1404088604881" version="3.7.1">
<!-- Generated by coverage.py: http://nedbatchelder.com/code/coverage -->
<packages>
<package branch-rate="0" complexity="0" line-rate="1" name="">
<classes>
<class branch-rate="0" complexity="0" filename="test.py" line-rate="1" name="test">
<methods/>