Skip to content

Instantly share code, notes, and snippets.

View colthreepv's full-sized avatar

valerio coltre colthreepv

View GitHub Profile
#!/bin/bash
echo time sh -c "dd if=/dev/zero of=ddfile bs=8k count=1000000 && sync"
echo dd if=/dec/zero of=ddfile2 bs=8K count=500000
echo time dd if=ddfile of=/dev/null bs=8k
@colthreepv
colthreepv / tools.js
Last active August 29, 2015 14:14
NodeList to Array
// credits to: http://stackoverflow.com/questions/3199588/fastest-way-to-convert-javascript-nodelist-to-array
function toArray (nl) {
var l=nl.length, arr = new Array(l);
while(l--){arr[l]=nl[l];}
return arr;
}
@colthreepv
colthreepv / prerender-upstart.conf
Created March 13, 2015 13:59
Example upstart script to use with prerender-server https://prerender.io/
description "<description here>"
author "<author@email.com>"
start on filesystem or runlevel [2345]
stop on shutdown
# Automatically Respawn:
respawn
respawn limit 3 5
@colthreepv
colthreepv / another.yml
Last active August 29, 2015 14:18
Bug with sudo in ansible-pull 1.9.0.1
---
- name: trying to create a directory that requires sudo
file:
state=directory
path=/helloworld
# sudo should not be required there!
- name: removing it
file:
state=absent
@colthreepv
colthreepv / index.js
Created July 18, 2015 16:36
Recursively include files and convert paths to camelCase
// Recursively include files and convert paths to camelCase
var bulk = require('bulk-require');
exports = module.exports = bulk(__dirname, ['./!(index|_*|*.spec).js']);
Object.keys(exports).forEach(function (key) {
var camelCased = key;
camelCased = camelCased.replace(/-([a-z])/g, function (g) {
return g[1].toUpperCase();
});
if (camelCased !== key) {
exports[camelCased] = exports[key];
@colthreepv
colthreepv / catchall.nginx
Created August 29, 2015 14:25
Catchall rule for NGINX, it does not reply to requests outside of your server domains.
server {
listen 80;
return 444;
}
@colthreepv
colthreepv / .jshintrc
Last active December 19, 2015 14:19
My personal jshint settings on Sublime Text (usable on any plugin)
{
"passfail": false,
"maxerr": 10,
"browser": true,
"node": true,
"debug": false,
"devel": false,
"strict": false,
@colthreepv
colthreepv / .tmux.conf
Last active December 19, 2015 18:29
personal .tmux.conf, based off It has mouse highlight, mouse scroll.. very good configuration to use with Putty, or with a (better) non-tabbed ssh client https://github.com/tony/tmux-config
# status bar
set-option -g status-utf8 on
# https://github.com/seebi/tmux-colors-solarized/blob/master/tmuxcolors-256.conf
set-option -g status-bg colour235 #base02
set-option -g status-fg colour136 #yellow
set-option -g status-attr default
# default window title colors
set-window-option -g window-status-fg colour244 #base0
@colthreepv
colthreepv / Preferences.sublime-settings
Last active December 20, 2015 10:09
personal sublime preferences
{
"color_scheme": "Packages/User/Monokai (SL).tmTheme",
"ignored_packages":
[
"Vintage"
],
"font_size": 10,
"margin": 2,
"tab_size": 2,
"translate_tabs_to_spaces": true,
@colthreepv
colthreepv / nginx.github
Created August 6, 2013 09:08
nginx site for forwarding github
server {
listen 80;
server_name *.github;
location / {
proxy_set_header Host api.github.com;
proxy_pass https://api.github.com/;
}
access_log /var/log/nginx/github_access.log combined;