Skip to content

Instantly share code, notes, and snippets.

View romanr's full-sized avatar
😶

Roman Roan romanr

😶
View GitHub Profile
@dctrwatson
dctrwatson / gist:7206322
Last active February 12, 2018 14:30
Jank way to use instance storage automatically in EC2
#cloud-config
mounts:
- [ ephemeral0, /var, ext4, "defaults,noatime", "0", "2" ]
- [ swap, null ]
bootcmd:
- mkdir -p /tmp/root
- mount --bind / /tmp/root
- rsync -aq /tmp/root/var/lib/cloud /var/lib/
@philfreo
philfreo / elb.py
Created September 26, 2013 18:19
Python script to remove/add an EC2 instance into an AWS ELB. Helpful during deployments. (Using Flask / Flask-Script but easily modifiable)
#!/usr/bin/env python
import time
import boto
import boto.ec2.elb
import boto.utils
from flask.ext.script import Manager
from closeio.main import setup_app
@bentford
bentford / AutoLayoutLabel
Created June 17, 2013 20:49
Shows how to implement a multiline UILabel with Auto Layout. It will dynamically resize to fit whatever horizontal constraints you apply.
@interface AutoLayoutLabel : UILabel
@end
@implementation AutoLayoutLabel
{
CGFloat overrideWidth;
}
- (id)init
The enclosed config.xml file will instruct Jenkins to check out and build llvm + clang, archiving the resulting clang binary.
The configuration will build daily and will retain builds for 5 days.
To add it to your Jenkins install, just copy the config.xml file to e.g.:
jobs/Clang/config.xml
Then "reload configuration" in Jenkins, or stop and start Jenkins to reload it implicitly.
@alexjs
alexjs / cors-nginx.conf
Created November 28, 2012 22:42 — forked from michiel/cors-nginx.conf
Slightly tighter CORS config for nginx
#
# Slightly tighter CORS config for nginx
#
# A modification of https://gist.github.com/1064640/ to include a white-list of URLs
#
# Despite the W3C guidance suggesting that a list of origins can be passed as part of
# Access-Control-Allow-Origin headers, several browsers (well, at least Firefox)
# don't seem to play nicely with this.
#
@jayj
jayj / flexbox.less
Last active November 20, 2023 04:51
CSS3 Flexbox - LESS Mixins
// --------------------------------------------------
// Flexbox LESS mixins
// The spec: http://www.w3.org/TR/css3-flexbox
// --------------------------------------------------
// Flexbox display
// flex or inline-flex
.flex-display(@display: flex) {
display: ~"-webkit-@{display}";
display: ~"-ms-@{display}box"; // IE10 uses -ms-flexbox
@marktheunissen
marktheunissen / pedantically_commented_playbook.yml
Last active April 26, 2024 23:26 — forked from phred/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
This playbook has been removed as it is now very outdated.
@jboner
jboner / latency.txt
Last active June 3, 2024 02:58
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@nicklockwood
nicklockwood / ARCHelper.h
Last active November 20, 2018 10:02
ARC Helper
//
// ARC Helper
//
// Version 2.2
//
// Created by Nick Lockwood on 05/01/2012.
// Copyright 2012 Charcoal Design
//
// Distributed under the permissive zlib license
// Get the latest version from here:
@jodell
jodell / shmsetup.sh
Created October 13, 2011 18:54
kernel shared memory calculator
#!/bin/bash
# http://archives.postgresql.org/pgsql-admin/2010-05/msg00285.php
# Output lines suitable for sysctl configuration based
# on total amount of RAM on the system. The output
# will allow up to 50% of physical memory to be allocated
# into shared memory.
# On Linux, you can use it as follows (as root):
#
# ./shmsetup >> /etc/sysctl.conf