Skip to content

Instantly share code, notes, and snippets.

#!/bin/env python3
import argparse
import json
import os.path
parser = argparse.ArgumentParser()
parser.add_argument("files", nargs="+", help="JSON files containing RDD infos per stage")
args = parser.parse_args()
@clee704
clee704 / pat.py
Last active May 21, 2024 06:29
Azure DevOps PAT helper
# Moved to https://github.com/clee704/azure-pat-helper
@clee704
clee704 / a.cpp
Created September 2, 2016 08:56
Make a unary lambda function from a pointer to function/data member (C++14)
#include <functional>
#include <iostream>
#include <utility>
using namespace std;
template<class>
struct memfun_traits {};
template<class C, class R, class... Args>
@clee704
clee704 / matcher.py
Last active November 28, 2015 12:34
Simple tag expression matcher
LPAR = 0
RPAR = 1
AND = 2
OR = 3
NOT = 4
IDENT = 5
EOF = 6
token_names = ('LPAR', 'RPAR', 'AND', 'OR', 'NOT', 'IDENT', 'EOF')
@clee704
clee704 / bitrot.py
Last active August 29, 2015 14:07
Randomly flip bits in the file
#! /usr/bin/env python
# Randomly flip bits in the file.
import argparse
import random
parser = argparse.ArgumentParser()
parser.add_argument('file', help='the file whose bits to be fliped')
parser.add_argument('count', type=int, default=1, nargs='?', help='number of rounds of bit flipping (default: 1)')
args = parser.parse_args()

Keybase proof

I hereby claim:

  • I am clee704 on github.
  • I am choongmin (https://keybase.io/choongmin) on keybase.
  • I have a public key whose fingerprint is BCDF 9A00 2376 BF71 257A 21AE 1884 CDAA F39E 8F3F

To claim this, I am signing this object:

@clee704
clee704 / ponder.py
Created May 15, 2014 16:45
Ponder This - August 2009
#! /usr/bin/env python3
# Solution to http://domino.research.ibm.com/Comm/wwwr_ponder.nsf/Challenges/August2009.html
import string
import sys
def main():
a = Expression('a', int('00001111', 2))
b = Expression('b', int('00110011', 2))
c = Expression('c', int('01010101', 2))
// Makes the element be vertically centered in its parent.
angular.module('mygists', [])
.directive('verticalCenter', function ($window, $timeout) {
var win = angular.element($window);
function reposition(element, firstTime) {
var parent = element.parent();
var parentHeight = parent.innerHeight();
var elementHeight = element.outerHeight();
var top = (parentHeight - elementHeight) / 2;
@clee704
clee704 / image_downloader.py
Last active August 29, 2015 13:58
Image Downloader
#! /usr/bin/env python
# Copyright 2014 Choongmin Lee
# Licensed under the MIT License
from __future__ import print_function
import argparse
from datetime import datetime
import os
import re
import sys
from tempfile import NamedTemporaryFile
@clee704
clee704 / prime.py
Last active August 29, 2015 13:57
Generate and test prime numbers
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2014 Choongmin Lee
# Licensed under the MIT License
import argparse
from random import SystemRandom
import sys
parser = argparse.ArgumentParser(description='Generate or test prime numbers.')