Skip to content

Instantly share code, notes, and snippets.

View ffbit's full-sized avatar

D H ffbit

  • Here GmbH
  • Germany, Frankfurt am Main Area
View GitHub Profile
@mikepfeiffer
mikepfeiffer / stress.sh
Created January 27, 2019 21:05
Install Stress Utility on Amazon Linux 2
sudo amazon-linux-extras install epel -y
sudo yum install stress -y
#!/bin/sh
#
# Converts branch name 'MAPP-452_how-is-it-going' into a commit message 'MAPP-452 How is it going'
#
if ! [ -z $2 ]
then
if ! [ "message" == $2 ]
then
@raindev
raindev / game-of-life.hs
Created November 15, 2014 18:23
Game of life produced on the last coding session of Kyiv Global Day of Coderetreat 2014
import Data.List
-- Transform cells into next iteration
nextTurn :: (Integral a) => [(a,a)] -> [(a,a)]
nextTurn space = [(x, y) | (x,y,_) <- [head xs | xs <- cells space, length xs == 3 || (length xs == 4 && True `elem` ([x | (_,_,x) <- xs]))]]
-- Cells grouped by their coordinates
cells :: (Integral a) => [(a,a)] -> [[(a,a,Bool)]]
cells space = groupBy (\(x1,y1,_) (x2,y2,_) -> x1 == x2 && y1 == y2) (sort (neighbourhood space))
@AlexDenisov
AlexDenisov / Makefile
Last active January 1, 2016 16:09
Flex/Bison studying.
all: calc
calc: parser lexer
CC lexer.c parser.c -o calc
lexer:
flex -o lexer.c lexer.l
parser:
bison -d -o parser.c parser.y
@kujohn
kujohn / portforwarding.md
Last active April 27, 2024 20:16
Port forwarding in Mavericks

Port Forwarding in Mavericks


Since Mavericks stopped using the deprecated ipfw (as of Mountain Lion), we'll be using pf to allow port forwarding.

####1. anchor file Create an anchor file under /etc/pf.anchors/<anchor file> with your redirection rule like:

@trukhinyuri
trukhinyuri / asyncForeach.js
Last active December 17, 2015 12:38
Async Foreach
function asyncForeach(array, fn, callback) {
var completed = 0;
var arrayLength = array.length;
if(arrayLength === 0) {
callback();
}
for(var i = 0; i < arrayLength; i++) {
fn(array[i], i, function() {
completed++;
if(completed === arrayLength) {
@sstephenson
sstephenson / super.bash
Last active January 30, 2017 01:40
`super` in Bash
#!/usr/bin/env bash
source super.bash
foo() {
echo hello
}
super_function foo
foo() {
@terigina
terigina / MessageLoader.java
Created December 24, 2012 19:56
Localized message loader with edited candidate bundle name list. Put *.properties files to /opt/messages and run java application.
package org.test;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
@agleyzer
agleyzer / gist:3859749
Created October 9, 2012 16:04
Download infoq video
#!/usr/bin/env python
# Looking for MP4 videos in infoq content.
#
# <div style="width: 320px; height: 265px; float: left; margin-right: 10px;">
# <video poster="/styles/i/logo_scrubber.png" id="video" controls="controls" width="320" height="265">
# <source src="http://d1snlc0orfrhj.cloudfront.net/presentations/12-mar-lockfreealgorithms.mp4" />
# </video>
# </div>
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this: