Skip to content

Instantly share code, notes, and snippets.

@mtimkovich
mtimkovich / cpps.sh
Created Jun 29, 2017
like go run but for c++
View cpps.sh
cpps() {
exe=/tmp/$(basename $1 .cpp)
g++ -std=c++11 -g -O0 $1 -o $exe || return 1
if [ -z "$2" ]
then
$exe
else
$exe "${@:2}"
@mtimkovich
mtimkovich / HashMap.cpp
Last active Jul 2, 2017
Remaking hash tables
View HashMap.cpp
#include <iostream>
#include <vector>
template <class K, class V>
class HashMap;
template <class K, class V>
class Entry {
K const key;
V value;
@mtimkovich
mtimkovich / curling.py
Last active Feb 15, 2019
Make url requests from yaml file
View curling.py
#!/usr/bin/env python3
"""
Usage: curling.py input.yml
The input yaml file is structured like this. |method| is optional,
but must be lowercase.
url: url
method: get
params:
View .bashrc
PS1="[\u@\h \W]\$ "
alias ..="cd .."
alias ls="ls -GAF"
alias cp='cp -vi'
alias mv='mv -vi'
alias rm='rm -vi'
mdc()
{
@mtimkovich
mtimkovich / like.js
Last active Jan 24, 2017
Facebook Like Bot
View like.js
// Run in developer console
// var likes = document.getElementsByClassName('UFILikeLink _4x9_'); // Just for posts
var likes = document.getElementsByClassName('UFILikeLink'); // For all likes
(function clicker (links) {
setTimeout(() => {
links[0].click();
if (links.length > 1) {
clicker(links.slice(1));
@mtimkovich
mtimkovich / move_mouse.py
Last active Jan 16, 2017
Keep Ernest's Computer awake
View move_mouse.py
#!/usr/bin/python
import autopy
import time
# Requires autopy from https://github.com/msanders/autopy
def move(x, y):
try:
autopy.mouse.move(x, y)
time.sleep(1)
View fuzzy_clock.py
#!/usr/bin/env python3
from datetime import datetime
word = {
1: 'one',
2: 'two',
3: 'three',
4: 'four',
5: 'five',
6: 'six',
@mtimkovich
mtimkovich / rename.py
Last active Dec 13, 2016
Mass rename files with python
View rename.py
#!/usr/bin/env python3
import argparse
from glob import glob
import os
import re
import sys
def parse_args():
parser = argparse.ArgumentParser('Rename files using regex')
@mtimkovich
mtimkovich / mail.py
Last active May 3, 2019
For Claire. Marks all emails as read.
View mail.py
#!/usr/bin/env python3
from imapclient import IMAPClient, SEEN
auth = {
# Enter your user name and password between the quotes below.
'username': 'USERNAME',
'password': 'PASSWORD',
'host': 'imap.gmail.com',
}
@mtimkovich
mtimkovich / beer-song.scm
Last active Nov 12, 2016
You already know
View beer-song.scm
(use format)
(define (beer-song n)
(format #t "~A bottle~:P of beer on the wall.~%" n)
(format #t "~A bottle~:P of beer.~%" n)
(print "Take one down.")
(print "Pass it around.")
(let ((n (- n 1)))
(if (> n 0)
(begin