Skip to content

Instantly share code, notes, and snippets.

Avatar

Eric Hanchrow offby1

View GitHub Profile
View wat.py
import hashlib
for n in range(0, 100):
hash_rep = hashlib.sha256()
hash_rep.update(str(n).encode ('utf-8'))
print(hash_rep.hexdigest())
View wat.py
import personalData
def main():
print('Let\'s create an Address Book: ')
book = []
while True:
entry = personalData.from_console()
print('You\'ve entered the following: ')
print (entry)
View data.py
[{'approved_at_utc': None,
'author': 'Philosinerd',
'author_flair_css_class': None,
'author_flair_text': None,
'banned_at_utc': None,
'body': 'Unfortunately it depends on whether or not she appears on national '
'television.',
'can_mod_post': False,
'collapsed': False,
'collapsed_reason': None,
View wat.py
import requests
from pprint import pprint
postID = '7dn55x'
#c=requests.get('https://api.pushshift.io/reddit/search/comment/?ids=' + ','.join(requests.get('https://api.pushshift.io/reddit/submission/comment_ids/' + postID).json()['data'])).json()['data']
import ast
c = ast.literal_eval(open ('/tmp/data').read ())
class RedditComment ():
def __init__ (self, id_, parent_id, other_stuff):
self.id_ = id_
View wat.py
## With a function:
def translate():
input_ = get_input()
output = english_to_pig_latin(input_)
clear_screen()
print(output)
if __name__ == "__main__":
View wat.py
import random
def get_locations(cell):
return (random.sample(cell,x),
random.sample(cell,x),
random.sample(cell,x))
# or the way I'd really write it
def get_locations(cell):
View gist:9ddb1464438d0a7eab4c806fe5f70420
time racket 14.ss
837799 generates a sequence of length 525
real 0m4.389s
user 0m4.141s
sys 0m0.229s
Model Name: MacBook Pro
Model Identifier: MacBookPro10,2
Processor Name: Intel Core i5
View init-keybindings.el
(defun copy-buffer-file-name ()
"Puts the file name of the current buffer (or the current directory,
if the buffer isn't visiting a file) onto the kill ring, so that
it can be retrieved with \\[yank], or by another program."
(interactive)
(let ((fn (or
(buffer-file-name (current-buffer))
;; Perhaps the buffer isn't visiting a file at all. In
;; that case, let's return the directory.
(expand-file-name default-directory))))
View gist:b2113d12994621fd3676ce082844c5f4
#
# Mac OS X Notice
#
# This file is not used by the host name and address resolution
# or the DNS query routing mechanisms used by most processes on
# this Mac OS X system.
#
# This file is automatically generated.
#
domain PK5001Z
View my_dumb_script
#!/usr/bin/env python3
print ("Hello")
# ./my_dumb_script
# Hello