Skip to content

Instantly share code, notes, and snippets.

View amosshapira's full-sized avatar

Amos Shapira amosshapira

  • Sydney, Australia
View GitHub Profile
@amosshapira
amosshapira / 0_reuse_code.js
Created November 11, 2015 01:45
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
# If you're looking into the C10M problem (10 million concurrent connections)
# you might want to play with DPDK (Originally proprietry Intel, now open source)
#
# C10M: http://c10m.robertgraham.com/
# DPDK: http://dpdk.org/
#
# This is a quick summary how to install dpdk on ubuntu
# running inside virtualbox on a mac
# On my Mac:
require 'gsl'
require 'time'
module Diskalerter
class ThresholdEstimator
attr_reader :timestamps, :signal, :threshold, :now
# timestamps - a list of timestamps in epoch milliseconds
# signal - a list of values for the provided timestamps
# threshold - the "exhaustion" threshold (e.g., 100 for a percentage signal)
@amosshapira
amosshapira / copy-from-time-machine.sh
Created January 23, 2016 22:32 — forked from vjt/copy-from-time-machine.sh
Copy data from a Time Machine volume mounted on a Linux box.
#!/bin/bash
#
# Copy data from a Time Machine volume mounted on a Linux box.
#
# Usage: copy-from-time-machine.sh <source> <target>
#
# source: the source directory inside a time machine backup
# target: the target directory in which to copy the reconstructed
# directory trees. Created if it does not exists.
#
development:
adapter: mysql2
encoding: utf8
database: my_database
username: root
roles:
- admin
- developer
- guest
password:
@amosshapira
amosshapira / aws-bootstrap-puppetmaster
Created May 11, 2016 12:24 — forked from gehel/aws-bootstrap-puppetmaster
Bootstrap a puppet master on AWS
#!/bin/sh
# create custom fact to identify the role of this server
mkdir -p /etc/facter/facts.d/
echo "server_role=puppetmaster" >> /etc/facter/facts.d/server_role.txt
# make sure everything is up to date
wget http://apt.puppetlabs.com/puppetlabs-release-raring.deb
dpkg -i puppetlabs-release-raring.deb
apt-get update
@amosshapira
amosshapira / tmpfsroot-el6.sh
Created June 20, 2016 20:14 — forked from lorengordon/tmpfsroot-el6.sh
Create AWS AMIs from Scratch
#!/bin/bash
#
# Pivot the root partition to a tmpfs mount point so that the root volume can
# be re-partitioned.
#
##############################################################################
set -x
set -e
# Prevent selinux from interfering
@amosshapira
amosshapira / cloudformation-aws-elasticsearch.json
Created September 27, 2016 04:39 — forked from mirajavora/cloudformation-aws-elasticsearch.json
Elastic Search AWS Cloudformation Script
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "Creates auto scaling Elastic Search Cluster",
"Parameters" : {
"InstanceType" : {
"Description" : "Elastic Search node instance type",
"Type" : "String",
"Default" : "t2.small",
@amosshapira
amosshapira / coreid.sh
Created March 21, 2017 22:28 — forked from philcryer/coreid.sh
Get the Amazon CoreOS AMI ID and URL
#!/bin/bash
build=alpha # define build ["stable", "beta", "alpha"]
disk=hvm # define disk backing ["pv", "hvm"]
if [ "x$1" = "x" ]; then
echo "Usage: $0 REGION"; exit 1
fi
#### deprecated
set hostnames to {"web01", "sys01", "mem01", "redis01"}
if application "iTerm" is running then
tell application "iTerm"
create window with default profile
tell current tab of current window
select
tell current session
-- make the window fullscreen