Skip to content

Instantly share code, notes, and snippets.

View nylki's full-sized avatar

Tom Brewe nylki

View GitHub Profile
@jjdelc
jjdelc / crayola.json
Created February 20, 2012 06:32
Crayola colors in JSON format
[
{
"hex": "#EFDECD",
"name": "Almond",
"rgb": "(239, 222, 205)"
},
{
"hex": "#CD9575",
"name": "Antique Brass",
"rgb": "(205, 149, 117)"
@asabaylus
asabaylus / gist:3071099
Created July 8, 2012 14:12
Github Markdown Heading Anchors

Anchors in Markdown

To create an anchor to a heading in github flavored markdown. Add - characters between each word in the heading and wrap the value in parens (#some-markdown-heading) so your link should look like so:

[create an anchor](#anchors-in-markdown)

@archagon
archagon / gdc-downloader.py
Last active March 21, 2024 19:04
A quick and dirty script to download GDC Vault videos.
# GDC Vault videos can't be watched on mobile devices and this is a very sad thing indeed!
# (Note: this has changed for GDC2013, which lets you watch raw MP4 streams. Kudos!)
# This script is designed to circumvent this by downloading the lecture and slideshow
# videos which can then be re-encoded into whatever format you wish. Obviously, you
# won't be able to do this without access to the Vault. This is strictly for the
# convenience of legitimate Vault users!
# Note: this code is rather flimsy and was written as fast as possible for my own personal use.
# The code only works for the most recent GDC Vault videos, since they all use the same player
# format. If the XML format used to run the player is changed (as it has in the past), the code
@mojavelinux
mojavelinux / atom-fedora-20.adoc
Last active September 26, 2022 18:21
Instructions for building and launching the Atom text editor on Fedora 20.

Using Atom on Fedora 20

This guide walks you through the steps of building and launching the Atom text editor on Fedora 20.

Building Atom

  1. Install prerequisite packages

[Unit]
Description=Multitouch und Wacom Treiber nach dem Aufwachen neustarten
After=suspend.target
[Service]
Type=oneshot
ExecStart=/sbin/modprobe -r hid_multitouch ; /sbin/modprobe hid_multitouch ; /sbin/modprobe -r wacom ; /sbin/modprobe wacom
[Install]
@nolanlawson
nolanlawson / protips.js
Last active February 4, 2024 18:06
Promise protips - stuff I wish I had known when I started with Promises
// Promise.all is good for executing many promises at once
Promise.all([
promise1,
promise2
]);
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");
@karpathy
karpathy / min-char-rnn.py
Last active July 22, 2024 04:44
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@zwang
zwang / loadFont.swift
Last active March 23, 2022 12:33
Dynamically load font from a font file in swift in IOS
static func loadFont(fontName: String, baseFolderPath: String) -> Bool {
let basePath = baseFolderPath as NSString
let fontFilePath = basePath.stringByAppendingPathComponent(fontName)
let fontUrl = NSURL(fileURLWithPath: fontFilePath)
if let inData = NSData(contentsOfURL: fontUrl) {
var error: Unmanaged<CFError>?
let cfdata = CFDataCreate(nil, UnsafePointer<UInt8>(inData.bytes), inData.length)
if let provider = CGDataProviderCreateWithCFData(cfdata) {
if let font = CGFontCreateWithDataProvider(provider) {
if (!CTFontManagerRegisterGraphicsFont(font, &error)) {
@alexradzin
alexradzin / selftar.sh
Last active November 18, 2023 21:24
Script that creates self extracting executable script from tar.gz file.
#!/bin/sh
if [ $# -eq 0 ]; then
echo "This script creates self extractable executable"
echo Usage: $0 TAR.GZ [COMMAND]
exit;
fi
if [ $# -gt 0 ]; then
TAR_FILE=$1
@ncou
ncou / interval.js
Created April 17, 2016 21:38 — forked from jasdeepkhalsa/interval.js
setTimeout and setInterval with pause and resume
// http://stackoverflow.com/questions/7279567/how-do-i-pause-a-window-setinterval-in-javascript
function RecurringTimer(callback, delay) {
var timerId, start, remaining = delay;
this.pause = function() {
window.clearTimeout(timerId);
remaining -= new Date() - start;
};