Skip to content

Instantly share code, notes, and snippets.

Yorick Peterse YorickPeterse

Block or report user

Report or block YorickPeterse

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@YorickPeterse
YorickPeterse / fan-control.sh
Last active Dec 15, 2015
Poor man's fan control for Macbooks that run Linux.
View fan-control.sh
#!/usr/bin/env bash
set -e
minimum=2000
medium=4500
maximum=6200
value=$minimum
@YorickPeterse
YorickPeterse / ruby-prof.patch
Created Jul 7, 2013
Patches to get ruby-prof working with MRI 1.9.3, taken from https://github.com/skaes/rvm-patchsets
View ruby-prof.patch
diff --git a/gc.c b/gc.c
index 0f84e22..feb54f1 100644
--- a/gc.c
+++ b/gc.c
@@ -98,6 +98,15 @@ ruby_gc_params_t initial_params = {
#endif
};
+#ifndef HAVE_LONG_LONG
+#define LONG_LONG long
@YorickPeterse
YorickPeterse / pomodoro.sh
Created Jul 16, 2013
Poor man's Pomodoro timer.
View pomodoro.sh
#!/usr/bin/env bash
time=1500 # 25 minutes
title="Pomodoro"
icon=/home/yorickpeterse/Pictures/icons/tomato.png
notify-send -i "$icon" "$title" "Starting a new Pomodoro timer"
sleep $time
@YorickPeterse
YorickPeterse / PKGBUILD
Created Jul 17, 2013
PKGBUILD for building Android 4 on Arch Linux.
View PKGBUILD
pkgname=android-4.0.3
pkgver=r03
pkgrel=3
pkgdesc='Platform for Google Android SDK'
arch=('any')
url="http://developer.android.com/sdk/index.html"
license=('custom')
depends=('android-sdk>=r17')
_android_api=android-15
_android_ver=android-4.0.4
@YorickPeterse
YorickPeterse / tag_count.rb
Created Jan 1, 2014
Counting the amount of title tags of a sub-reddit. Whipped together to see which ones on /r/r4r get the most comments.
View tag_count.rb
require 'httpclient'
require 'json'
url = 'http://www.reddit.com/r/r4r.json'
after = nil
posts = []
client = HTTPClient.new
tags = {
'[M4F]' => 0,
'[M4M]' => 0,
@YorickPeterse
YorickPeterse / env_madness.md
Created Mar 3, 2014
Universal Ruby Environment/Mode Variables
View env_madness.md

This Gist aims to get some discussion going and throw some ideas around about introducing a more universal way to configure the environment/mode of Ruby applications and libraries (where applicable).

When speaking about the environment/mode (referred to as "environment" from this point on) we're speaking about the variable/option that specifies a alternative set of configuration options to use. That is, separate database options, hostnames and so on. A basic example of this is the standard Rails database configuration file:

@YorickPeterse
YorickPeterse / syntax.rake
Created Mar 7, 2014
Checking the syntax of various Ruby related files in a Rails project.
View syntax.rake
namespace :syntax do
desc 'Checks the syntax of ERB files'
task :erb do
require 'action_view'
Dir['app/views/**/*.erb'].each do |file|
template = File.read(file)
begin
ActionView::Template::Handlers::Erubis \
@YorickPeterse
YorickPeterse / bench_node.sh
Created Mar 14, 2014
Accurate proof that Ruby is closer to the bear metal than Node.js
View bench_node.sh
#!/usr/bin/env bash
siege -c 10 -b -t 30s http://localhost:9393
View gist:9652463
with Rubinius.synchronize:
$ ./bin/benchmark core/file/bench_each_byte.rb
=== rbx ===
File#each_byte with a small file
29.1 (±0.0%) i/s - 146 in 5.023101s (cycle=2)
File#each_byte with a medium file
3.3 (±0.0%) i/s - 17 in 5.228034s (cycle=1)
File#each_byte with a large file
0.3 (±0.0%) i/s - 2 in 6.110730s (cycle=1)
View mri_211.out
desc: (none)
cmd: ruby rss_growth_during_redis_publish.rb -n 1000000
time_unit: i
#-----------
snapshot=0
#-----------
time=0
mem_heap_B=0
mem_heap_extra_B=0
mem_stacks_B=0
You can’t perform that action at this time.