A ZSH theme optimized for people who use:
- Solarized
- Git
- Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)
| from uuid import uuid1 | |
| from time import time | |
| def main(): | |
| test = dict() | |
| limit = 10 ** 10 | |
| while limit: | |
| limit -= 1 | |
| x = {n:uuid1().hex for n in range(15)} | |
| if len(set(x.values())) != len(x.keys()): |
| import matplotlib.pyplot as plt | |
| import numpy as np | |
| input = open("stage2-input.bin", "rb").read() | |
| bin = map(int, list(''.join(map(lambda s: s[2:], map(bin, map(ord, list(input))))))) | |
| results = np.correlate(bin, bin, mode='full') | |
| results = results[results.size/2:] | |
| plt.plot(results[0:255]) |
| # The blog post that started it all: https://neocities.org/blog/the-fcc-is-now-rate-limited | |
| # | |
| # Current known FCC address ranges: | |
| # https://news.ycombinator.com/item?id=7716915 | |
| # | |
| # Confirm/locate FCC IP ranges with this: http://whois.arin.net/rest/net/NET-165-135-0-0-1/pft | |
| # | |
| # In your nginx.conf: | |
| location / { |
| numpy.genfromtxt(path, delimiter=',', names=True, dtype=None) | |
| fig = plt.figure(1) | |
| plt.xlabel('Month') | |
| plt.ylabel('Cost of Food') | |
| plt.title('Cost of Food from May 2013 to May 2014) | |
| # month is a tuple I created for this data, month[0] is number of month, month[1] is numpy array | |
| plt.plot_date([month[0] for month in data], [month[1][0][plan] for month in data], '-b', label=month[1][0][1]) |
| function dataURItoBlob(dataURI) { | |
| // convert base64 to raw binary data held in a string | |
| var byteString = atob(dataURI.split(',')[1]); | |
| // separate out the mime component | |
| var mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0]; | |
| // write the bytes of the string to an ArrayBuffer | |
| var arrayBuffer = new ArrayBuffer(byteString.length); | |
| var _ia = new Uint8Array(arrayBuffer); |
| /** | |
| * Sample of serverside generation of Highcharts using an extension to jsdom in node.js. | |
| * | |
| * Usage: | |
| * npm install jsdom | |
| * npm install highcharts | |
| * node highcharts-jsdom | |
| */ | |
| /* eslint-env node */ |
| import JsEither._ | |
| case class Page(id: Int, name: String, screen_name: String, is_closed: Int, photo_50: String, photo_100: String, photo_200: String) | |
| object Page { | |
| implicit val format = Json.format[Page] | |
| } | |
| case class Profile(id: Int, first_name: String, last_name: String) | |
| object Profile { | |
| implicit val format = Json.format[Profile] |
| $FILES="*.rs" | |
| $REGEX="s#(.*)\n(.*)/\2\n\1/" | |
| find . -name "$FILES" | xargs perl -0777 -pi -e '$REGEX' | |
| # flag: -0777 tells perl to read the file as a whole | |
| # replace '-pi' with '-pi.bak' to create backups |
| FROM selenium/node-base:3.4.0-dysprosium | |
| USER root | |
| ARG CHROME_VERSION="google-chrome-beta" | |
| RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ | |
| && echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list \ | |
| && apt-get update -qqy \ | |
| && apt-get -qqy install \ |