Skip to content

Instantly share code, notes, and snippets.

@ahirschberg
ahirschberg / barclays_summer.js
Last active Feb 23, 2020
Creates a {Name: Sum} mapping of all the transactions on a Barclays bank statement page for a desired month
View barclays_summer.js
(month_desired => {
let store = {}
let transactions = document.querySelectorAll('.panel');
for (let t of transactions) {
let name = t.querySelector('.description').innerText;
let amt = parseInt(t.querySelector('.amount').innerText.replace(/[^0-9.]/g, ''));
let date = t.querySelector('.date').innerText;
if (date.toLowerCase().substring(0,3) != month_desired) {
console.log("Skipping", date);
} else {
@ahirschberg
ahirschberg / hw1_autograde.sh
Last active Feb 7, 2018
Moves canvas files into student folders
View hw1_autograde.sh
# TODO:
# change this to the folder where your jar files are
# you can download it from https://github.com/junit-team/junit4/wiki/Download-and-Install
# just change /usr/share/java to wherever you downloaded stuff (downloads, maybe)
jar_lib_folder_path="junit_libs"
# TODO:
# change these to the correct filenames for the jars you have
jarname_junit="junit-4.12.jar"
jarname_hamcrest="hamcrest-core-1.3.jar"
@ahirschberg
ahirschberg / setup_dotfiles.sh
Last active Aug 2, 2017
Alex Hirschberg brand dotfiles
View setup_dotfiles.sh
#!/bin/sh
# Install script for dotfiles repo
# Copyright © 2017 Alex Hirschberg
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
@ahirschberg
ahirschberg / cs1331-spr17-hw1straightas.md
Last active Feb 16, 2017
Made as a homework for Georgia Tech's CS1331 course in Spring 2017
View cs1331-spr17-hw1straightas.md

CS1331 Homework 01 - Straight As

Welcome to your first full-fledged programming assignment for CS1331! In this homework, you will be tasked with reading data files and using what you've learned so far to create a visualization of the data in your terminal.

Download zip

Things to know

This homework has several files contained within it. Here are some notes about them:

View TestTypes.java
import java.util.Set;
import java.util.HashSet;
public class TestTypes {
public static void main(String[] args) {
Class<?> t = Set.class;
Object s = new HashSet<String>();
Object n = new Integer(-1);
System.out.println(t.isInstance(s)); // true
System.out.println(t.isInstance(n)); // false
@ahirschberg
ahirschberg / master.rb
Created Dec 22, 2016
test ruby -> python interop via pipes
View master.rb
require 'open3'
require 'json'
require 'pry'
module Interop
def self.send json
result, status = Open3.capture2("python slave.py",
stdin_data: json)
status.to_s # noop, get rid of unused variable warning
JSON.parse(result)["return"]
View nin10kitprojectile.c
/*
* Exported with nin10kit v1.3
* Time-stamp: Tuesday 12/20/2016, 19:24:41
*
* Image Information
* -----------------
* /home/alex/projects/cool_game/assets/projectile_sprites.png 8@32
*
* Quote/Fortune of the Day!
* -------------------------
@ahirschberg
ahirschberg / mysort.c
Last active Feb 16, 2017
C Code for a CS2110 Sort Example, and my system output
View mysort.c
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <stdio.h>
#define OFFSET(arr, idx, size) ((void*) ((char*)arr) + ( idx ) * ( size ) )
// bubble sort http://www.algolist.net/Algorithms/Sorting/Bubble_sort
void yoursort(void *arr, size_t nelems, size_t size, int (*compar) (const void *, const void *)) {
bool swapped = true;
View ta_hw0_batch.rb
require 'pathname'
require 'shellwords'
dirs = Pathname.new('.').children.select { |c| c.directory? }
pwd = Pathname.pwd
begin
Dir.mkdir pwd + 'output'
rescue Errno::EEXIST
puts "directory existed already. great..."
end
dirs.each do |dir|
@ahirschberg
ahirschberg / pubspec.yaml
Last active May 3, 2016
For dart angular2 issue #8439: [Dart Angular2-beta.17] platform_directives only apply when compiled to JavaScript, not in Dart
View pubspec.yaml
name: angular2_getting_started
description: Quickstart
version: 0.0.1
environment:
sdk: '>=1.13.0 <2.0.0'
dependencies:
angular2: 2.0.0-beta.17
browser: ^0.10.0
dart_to_js_script_rewriter: ^1.0.1
transformers: