Hacking is really just the act of finding a clever and counterintuitive solution to a problem.
The hacks found in program exploits usually use the rules of the computer to bypass security in ways never intended. Programming hacks are similar in that they also use the rules of the computer in new and inventive ways, but the final goal is efficiency or smaller source code, not necessarily a security compromise. There are actually an infinite number of programs that can be written to accomplish any given task, but most of these solutions are unnecessarily large, complex, and sloppy. The few solutions that remain are small, efficient, and neat. Programs that have these qualities are said to have elegance, and the clever and inventive solutions that tend to lead to this efficiency are called hacks. Hackers on both sides of programming appreciate both the beauty of elegant code and the ingenuity of clever hacks.
In the business world, more importance is placed on churning out functional code than on
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option Explicit | |
Function INCOMENETTAU(ByVal gross As Double, Optional monthly = False) As Double | |
' (AU) Return the nett income after tax and Medicare Levy for the given gross income, optionally for a single month | |
Dim tax As Double | |
Dim medicareLevy As Double | |
Dim nett As Double | |
medicareLevy = gross * 0.02 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Fork of zrzk's tot.sh https://gist.github.com/zrzka/5948256ac72c3f3820aebff1fb4b1b70 | |
# which is a fork of gruber's tot.sh https://gist.github.com/gruber/b18d8b53385fa612713754799ed4d0a2 | |
# which is a fork of chockenberry's tot.sh https://gist.github.com/chockenberry/d33ef5b6e6da4a3e4aa9b07b093d3c23 | |
# Add possibility to access dots by default color names in addition to numbers and | |
# access first empty dot by 'empty' in addition to 0. | |
# Exit immediately if a pipeline returns a non-zero status. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# Don't call directly, called by `subtitles.sh` | |
"""Given an srt file, clean it up as much as possible to look like prose.""" | |
import re | |
import sys | |
bad_words = ['-->', 'WEBVTT', 'Language: en', 'Kind: captions'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
# known issues: | |
# plenty, but | |
# GitHub can't render it properly: see the raw version which is `perltidy` | |
# hardcodes image size and only looks for gifs | |
# has an iterator that goes over 9000 regardless of whether it's still | |
# getting images or not | |
# it was written for a particular Tumblr, so may need tweaking for others | |
# | |
# try: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# slow down crazy fast gaming mouse on X | |
if [[ `uname` == 'Darwin' ]]; then | |
echo "Exiting: I don't know what this does on macOS even with XQuartz." | |
exit 1; | |
fi | |
FASTMOUSE=$(xinput --list --short|grep -i sabre|cut -f 2 |sed 's/id=//g') | |
for id in ${FASTMOUSE[@]}; do | |
xinput --set-prop $id "Device Accel Constant Deceleration" 10 | |
xinput --set-prop $id "Device Accel Velocity Scaling" 10 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" Trains an agent with (stochastic) Policy Gradients on Pong. Uses OpenAI Gym. """ | |
import numpy as np | |
import cPickle as pickle | |
import gym | |
from chainer import cuda | |
import cupy as cp | |
import time, threading | |
#backend |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Install CUDA Toolkit v9.0 | |
# Instructions from https://developer.nvidia.com/cuda-downloads (linux -> x86_64 -> Ubuntu -> 16.04 -> deb (network)) | |
sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub | |
CUDA_REPO_PKG="cuda-repo-ubuntu1604_9.0.176-1_amd64.deb" | |
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/${CUDA_REPO_PKG} | |
sudo dpkg -i ${CUDA_REPO_PKG} | |
sudo apt-get update | |
sudo apt-get -y install cuda-9-0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# encoding: utf-8 | |
""" | |
mt940toOFX.py - Dieses Progrtamm liesst MT940 SWIFT Kontostände und konvertiert sie in OFX. | |
OFX wurde mit xero.com getestet. | |
Created by Maximillian Dornseif on 2010-06-05. | |
Copyright (c) 2010, 2013, 2014 HUDORA. All rights reserved. | |
""" |