Skip to content

Instantly share code, notes, and snippets.

View citostyle's full-sized avatar

Jürgen Cito citostyle

View GitHub Profile
@citostyle
citostyle / extract_submissions.py
Created October 9, 2018 22:22
Retrieve Reddit posts from a particular subreddit using the `praw` Python library
def extract_submissions(client_id, client_secret, user_agent, subreddit_name):
reddit = praw.Reddit(client_id=client_id, client_secret=client_secret, user_agent=user_agent)
subreddit = reddit.subreddit(subreddit_name)
submissions = [{'id': s.id, 'title': s.title, 'upvotes': s.ups, 'downvotes': s.downs, 'href': s.permalink, 'number_of_comments': s.num_comments, 'content': s.selftext}
for s in subreddit.hot(limit=None)]
return submissions
@citostyle
citostyle / sendGradeEmails.gs
Created February 13, 2018 19:23
Sending individual emails to students with App Script
function sendGradeEmails() {
var spreadSheet = SpreadsheetApp.getActiveSheet();
var dataRange = spreadSheet.getDataRange();
// Fetch values for each row in the Range.
var data = dataRange.getValues();
var template = "Dear {name},\n\n" +
"Here are your total percentage points (out of 100) for Software Construction:\n" +
"Exam: {exam}%\n" +
"Exercise: {exercise}%\n" +
"Total: {total}%\n" +
from sys import argv
def main(argv):
script, filename = argv
data = get_voltage_current(filename)
sum = 0
for item in data:
if item['current'] > 0:
sum = sum + (item['voltage'] * item['current'])
private static class ConnectionTransformer extends BodyTransformer {
@Override
protected void internalTransform(Body b, String phaseName, Map<String, String> options) {
SootMethod method = b.getMethod();
final PatchingChain<Unit> units = b.getUnits();
Unit u = null;
Iterator<Unit> iter = units.snapshotIterator();

Keybase proof

I hereby claim:

  • I am citostyle on github.
  • I am jcito (https://keybase.io/jcito) on keybase.
  • I have a public key whose fingerprint is E6A2 A577 1370 9809 D759 7F98 1168 301E 12FB 1E62

To claim this, I am signing this object: