Skip to content

Instantly share code, notes, and snippets.

View tuupola's full-sized avatar

Mika Tuupola tuupola

View GitHub Profile
@AndrewDryga
AndrewDryga / reload_vb_kernel.sh
Created March 30, 2014 22:23
Shell script to rebuild VirtualBox kernel extensions under Mac OS X
#!/bin/bash
unload() {
if [ `ps -ef | grep -c VirtualBox$` -ne 0 ]
then
echo "VirtualBox still seems to be running. Please investigate!!"
exit 1;
elif [ `ps -ef | grep -c [V]ir` -gt 0 ]
then
echo "Stopping running processes before unloading Kernel Extensions"
anonymous
anonymous / gist:8565929
Created January 22, 2014 19:42
There are a lot of complaints going around about Laravel these days, but a lot
of the important ones seem to be missing from the spotlight.
Bugfixes, issues and pull requests being left open for months with no
clarification of intent:
- https://github.com/laravel/framework/pull/1799
- https://github.com/laravel/framework/issues/1963
- https://github.com/laravel/framework/issues/2089
- https://github.com/laravel/framework/issues/2234
@maoueh
maoueh / gist:8260199
Last active March 31, 2022 12:30
OpenELEC (4.0.1) WIFI connection details using `connman`

Even though there is a nice XBMC add-on to configure your WIFI settings, sometimes, you may still want to setup the WIFI connection for many reasons or just for fur.

OpenELEC use connman for managing connection to the various available network.

Setuping connman to connect to your protected WIFI network is an easy requiring you only to create a config file and enter some commands in a shell.

@andrejbauer
andrejbauer / mandelbrot.c
Created December 11, 2013 22:23
A simple program for computing the Mandelbrot set.
/*
This program is an adaptation of the Mandelbrot program
from the Programming Rosetta Stone, see
http://rosettacode.org/wiki/Mandelbrot_set
Compile the program with:
gcc -o mandelbrot -O4 mandelbrot.c
Usage:
@chanks
chanks / gist:7585810
Last active February 29, 2024 03:50
Turning PostgreSQL into a queue serving 10,000 jobs per second

Turning PostgreSQL into a queue serving 10,000 jobs per second

RDBMS-based job queues have been criticized recently for being unable to handle heavy loads. And they deserve it, to some extent, because the queries used to safely lock a job have been pretty hairy. SELECT FOR UPDATE followed by an UPDATE works fine at first, but then you add more workers, and each is trying to SELECT FOR UPDATE the same row (and maybe throwing NOWAIT in there, then catching the errors and retrying), and things slow down.

On top of that, they have to actually update the row to mark it as locked, so the rest of your workers are sitting there waiting while one of them propagates its lock to disk (and the disks of however many servers you're replicating to). QueueClassic got some mileage out of the novel idea of randomly picking a row near the front of the queue to lock, but I can't still seem to get more than an an extra few hundred jobs per second out of it under heavy load.

So, many developers have started going straight t

@chriseldredge
chriseldredge / dnsmasq-regex.rb
Created November 9, 2013 19:30
Homebrew Formula for installing dnsmasq with regex patch from Jan Seiffert See: http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2013q2/007124.html
require 'formula'
class DnsmasqRegex < Formula
homepage 'http://www.thekelleys.org.uk/dnsmasq/doc.html'
url 'http://www.thekelleys.org.uk/dnsmasq/dnsmasq-2.66.tar.gz'
sha256 '36232fa23d1a8efc6f84a29da5ff829c2aa40df857b9116a9320ea37b651a982'
option 'with-idn', 'Compile with IDN support'
depends_on "libidn" if build.include? 'with-idn'
@panzi
panzi / portable_endian.h
Last active April 18, 2024 20:59
This provides the endian conversion functions form endian.h on Windows, Linux, *BSD, Mac OS X, and QNX. You still need to use -std=gnu99 instead of -std=c99 for gcc. The functions might actually be macros. Functions: htobe16, htole16, be16toh, le16toh, htobe32, htole32, be32toh, le32toh, htobe64, htole64, be64toh, le64toh. License: I hereby put …
// "License": Public Domain
// I, Mathias Panzenböck, place this file hereby into the public domain. Use it at your own risk for whatever you like.
// In case there are jurisdictions that don't support putting things in the public domain you can also consider it to
// be "dual licensed" under the BSD, MIT and Apache licenses, if you want to. This code is trivial anyway. Consider it
// an example on how to get the endian conversion functions on different platforms.
#ifndef PORTABLE_ENDIAN_H__
#define PORTABLE_ENDIAN_H__
#if (defined(_WIN16) || defined(_WIN32) || defined(_WIN64)) && !defined(__WINDOWS__)
@jbenet
jbenet / simple-git-branching-model.md
Last active April 9, 2024 03:31
a simple git branching model

a simple git branching model (written in 2013)

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.

@aaronpk
aaronpk / gist:5846789
Last active January 2, 2024 22:47
Added WebFinger support to my email address using one rewrite rule and one static file.
[aaron@parecki.com www]$ cat .htaccess
RewriteEngine on
RewriteCond %{QUERY_STRING} resource=acct:(.+)
RewriteRule ^\.well-known/webfinger /profile/%1? [L]
[aaron@parecki.com www]$ cat profile/aaron@parecki.com
{
"subject": "acct:aaron@parecki.com",
"links": [
{
@ziadoz
ziadoz / eloquent.php
Last active November 28, 2018 14:40
Laravel 4 Eloquent ORM Standalone (Observers, Query Logging).
<?php
class Post
{
protected $table = 'posts';
/**
* You can define your own custom boot method.
*
* @return void
**/