Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/python
"""
Plot Firefox's score in the Sunspider benchmark.
"""
from pylab import *
xlabel('Firefox version')
xticks(arange(20),
('3.0', '3.5', '3.5.6', '3.6', '3.6 w/TM', '3.7a5pre', '4.0 b1', '4.0 b4'))
ACADEMIC DOUBLE-SPEAK (in student papers)
* “It has long been known” - I didn’t look up the original reference.
* “A definite trend is evident” - the data is practically meaningless.
* “While it has not been possible to provide definitive answers to the questions” - an unsuccessful experiment but I still hope to get it published.
* “Three of the samples were chosen for detailed study” - the other results didn’t make sense.
* “Typical results are shown” - this is the prettiest graph.
* “In my experience” - once.
* “In case after case” - twice.
* “In a series of cases” - thrice
@radupotop
radupotop / fonts.conf.xml
Created March 10, 2012 20:46
fonts.conf
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<!-- http://ubuntuforums.org/showthread.php?t=1354116 -->
<fontconfig>
<!-- See: man 5 fonts-conf -->
<!-- Antialias rules -->
<match target="font">
<!--Subpixel smoothing: rgb, bgr, vrgb, vbgr, none-->
<edit mode="assign" name="rgba"><const>none</const></edit>
def fizzbuzz(n):
if n % 15 == 0:
print 'fizzbuzz'
elif n % 3 == 0:
print 'fizz'
elif n % 5 == 0:
print 'buzz'
else:
print n
@radupotop
radupotop / gist:4013294
Created November 4, 2012 19:48
PolKit rules to allow mounting, rebooting and network management without a password
// /etc/polkit-1/rules.d/10-rules.rules
// PolKit rules to allow mounting, rebooting and network management without a password.
// User needs to be in storage, power and network groups.
polkit.addRule(function(action, subject) {
if (action.id.match("org.freedesktop.udisks2.") && subject.isInGroup("storage")) {
return polkit.Result.YES;
}
});
[Unit]
Description=Gearman server
[Service]
User=gearman
ExecStart=/usr/sbin/gearmand --listen 127.0.0.1 --log-file /var/log/gearmand.log
Restart=always
[Install]
WantedBy=multi-user.target
#!/bin/bash
# Generate key and certificate for Apache.
openssl genrsa -des3 -out server.key 2048
openssl req -new -key server.key -out server.csr
cp server.key server.key.org
openssl rsa -in server.key.org -out server.key
openssl x509 -req -days 3660 -in server.csr -signkey server.key -out server.crt
module.exports = function(grunt) {
var appbanner = '/*! Sendmachine <%= grunt.template.today("yyyy-mm-dd HH:MM:ss Z") %> */\nvar build = "<%= grunt.template.today("yyyy-mm-dd HH:MM:ss Z") %>";\n';
grunt.initConfig({
//~pkg: grunt.file.readJSON('package.json'),
concat: {
options: {
@radupotop
radupotop / 20-intel.conf
Created January 24, 2014 13:21
/etc/X11/xorg.conf.d/20-intel.conf
# /etc/X11/xorg.conf.d/20-intel.conf
Section "Device"
Identifier "Intel Graphics"
Driver "intel"
Option "AccelMethod" "uxa"
Option "TearFree" "true"
EndSection
@radupotop
radupotop / Interview.js
Created April 22, 2014 12:55
Interview
/*
1. Whats the difference between a local and a global variable. Implement a bug that could be
caused by accidentally forgetting to var a local variable
*/
/**
A global variable is found in the global scope, eg. the window object, and can
be accessed from any other scope.
A local variable is contained within the scope of a function and can only be