Skip to content

Instantly share code, notes, and snippets.

@blainerothrock
blainerothrock / gen.swift
Last active July 12, 2018 15:56
A Very Simple Genetic Algorithm Written in Swift 3
#!/usr/bin/env xcrun swift -O
/*
gen.swift is a direct port of cfdrake's helloevolve.py from Python 2.7 to Swift 3
-------------------- https://gist.github.com/cfdrake/973505 ---------------------
gen.swift implements a genetic algorithm that starts with a base
population of randomly generated strings, iterates over a certain number of
generations while implementing 'natural selection', and prints out the most fit
string.
The parameters of the simulation can be changed by modifying one of the many
irritable
condescending
handsome
horrific
jittery
clear
pungent
impressionable
biting
icy
#define _GNU_SOURCE 1
#include <sched.h> // sched_setaffinity
#include <stdint.h>
#include <stdio.h>
#include <limits.h>
#include <stdlib.h>
#include <stdint.h>
#include <pthread.h>
#include <assert.h>
#include <sys/time.h>
#define _GNU_SOURCE 1
#include <sched.h> // sched_setaffinity
#include <stdint.h>
#include <stdio.h>
#include <limits.h>
#include <stdlib.h>
#include <stdint.h>
#include <pthread.h>
#include <assert.h>
#include <sys/time.h>
@omegahm
omegahm / create_labels.sh
Created April 7, 2015 19:00
Create Gtihub labels from Bash
#!/usr/bin/env bash
# Colours picked from https://robinpowered.com/blog/best-practice-system-for-organizing-and-tagging-github-issues/
###
# Label definitions
###
declare -A LABELS
# Platform
@coolaj86
coolaj86 / github-pages-https-lets-encrypt.md
Last active November 16, 2021 22:36
Github Pages: Let's Encrypt!
@Hidendra
Hidendra / redis-aggregate.lua
Last active December 5, 2019 02:33
Aggregate values in a redis sorted set. Returns {count, sum, min, max}
local result = redis.call('zrange', KEYS[1], 0, -1, 'withscores')
local count = 0
local sum = 0
local min = 0
local max = 0
for i=1, #result, 2 do
local score = result[i + 1]

Git Cheat Sheet

Commands

Getting Started

git init

or

@mpasternacki
mpasternacki / freebsd_on_mbp.md
Created January 23, 2015 17:12
FreeBSD on a MacBook Pro

FreeBSD on a MacBook Pro

Since 2008 or 2009 I work on Apple hardware and OS: back then I grew tired of Linux desktop (which is going to be MASSIVE NEXT YEAR, at least since 2001), and switched to something that Just Works. Six years later, it less and less Just Works, started turning into spyware and nagware, and doesn't need much less maintenance than Linux desktop — at least for my work, which is system administration and software development, probably it is better for the mythical End User person. Work needed to get software I need running is not less obscure than work I'd need to do on Linux or othe Unix-like system. I am finding myself turning away from GUI programs that I used to appreciate, and most of the time I use OSX to just run a terminal, Firefox, and Emacs. GUI that used to be nice and unintrusive, got annoying. Either I came full circle in the last 15 years of my computer usage, or the OSX experience degraded in last 5 years. Again, this is from a sysadmin/developer ki

@kern
kern / hh-descomp.md
Last active August 29, 2015 14:12
Hackathon Hackers Design Competition

Hackathon Hackers Design Competition

View the submissions and vote!

HH and HH Design have teamed up to host the first Hackathon Hackers Design Competition!

The cover photo for Hackathon Hackers is OLD. Like ancient. Like it’s the same one uploaded the day this group was created. It’s time for an update.

The creativity of the hacker community knows no bounds. We’re hoping you can come up with cover photo concepts that capture the unique ethos of student hackathons. So take some time out of your holiday break, spin up your favorite image editor, and try your hand at branding HH.