Skip to content

Instantly share code, notes, and snippets.

View aledbf's full-sized avatar

Manuel Alejandro de Brito Fontes aledbf

View GitHub Profile
@marineam
marineam / gist:9914debc25c8d7dc458f
Last active May 21, 2018 12:47
CoreOS dev container

Pending real documentation.... We do have a development container which includes the same toolchain version that was used to build CoreOS but it works under systemd-nspawn, not docker, and isn't documented. But here is a quick guide that may be a useful starting place.

# on coreos
wget http://alpha.release.core-os.net/amd64-usr/current/coreos_developer_container.bin.bz2
bunzip2 coreos_developer_container.bin.bz2
sudo systemd-nspawn -i coreos_developer_container.bin --share-system
@jamiekurtz
jamiekurtz / mongo-enc-provision.sh
Created October 17, 2014 21:55
Shell script for installing and configuring MongoDB on Ubuntu to use a secondary LUKS (dm-crypt) encrypted disk for its database files.
#!/bin/bash
# !!! This script assumes that the device needing to be formatted and encrypted is /dev/sdb
# !!! Also... be sure to copy and store the generated encryption key file from /root
# Note that the secondary drive will be mounted at /var/lib/mongodb,
# ... which is the default location for MongoDB data files on Ubuntu and Mongo at least v2.6
# add PPA for mongodb
@mathisonian
mathisonian / index.md
Last active March 22, 2023 05:31
requiring npm modules in the browser console

demo gif

The final result: require() any module on npm in your browser console with browserify

This article is written to explain how the above gif works in the chrome (and other) browser consoles. A quick disclaimer: this whole thing is a huge hack, it shouldn't be used for anything seriously, and there are probably much better ways of accomplishing the same.

Update: There are much better ways of accomplishing the same, and the script has been updated to use a much simpler method pulling directly from browserify-cdn. See this thread for details: mathisonian/requirify#5

inspiration

#!/bin/bash
# apt-get install jq
#set -eu
shopt -s nullglob
readonly base_dir=$1
if [ -z "$base_dir" ] ; then
echo 'please location docker registry store location!';
exit;
fi
@amirkdv
amirkdv / Transparent Proxy to docker containers.md
Last active August 22, 2020 02:14
Transparent Proxy to docker containers

This is an example of using Linux Kernel's Transparent Proxy to route all TCP traffic to docker containers without having to resort to PROXY protocol which is not supported by some applications (e.g. sshd). To get the demo to work you only need vagrant installed:

git clone [this-gist] tproxy-demo
cd tproxy-demo
vagrant up

The prep-script.sh will setup the latest Node and install the latest perf version on your Linux box.

When you want to generate the flame graph, run the following (folder locations taken from install script):

sudo sysctl kernel/kptr_restrict=0

perf record -i -g -e cycles:u -- ~/sources/node/node --perf-basic-prof script.js

perf script | egrep -v "( __libc_start| LazyCompile | v8::internal::| Builtin:| Stub:| LoadIC:|\[unknown\]| LoadPolymorphicIC:)" | sed 's/ LazyCompile:[*~]\?/ /' | ~/sources/FlameGraph/stackcollapse-perf.pl > out.perf-folded
@ankurcha
ankurcha / backupStatus.json
Last active October 23, 2015 06:11
Script to backup tokumx database to a directory and/or S3.
{
"percent" : 6.297823041677475,
"bytesDone" : NumberLong("22117130240"),
"files" : {
"done" : 8,
"total" : 166
},
"current" : {
"source" : "/var/lib/mongodb_historical11/local_oplog_rs_p15_id__ddfdbfc0_1_19.tokumx",
"dest" : "/backup11/local_oplog_rs_p15_id__ddfdbfc0_1_19.tokumx",
docker:
registry: myregistry.com
servers:
- http://mynode01.com:4243
- http://mynode02.com:4243
collection: docker
repository-namespace: tsuru
router: hipache
deploy-cmd: /var/lib/tsuru/deploy
run-cmd:
@mindreframer
mindreframer / docker-clear-orphaned-volumes.py
Created December 4, 2013 13:51
volumes clearing script for docker, a copy from https://github.com/dotcloud/docker/issues/197 with some fixes
#!/usr/bin/python
import json
import os
import shutil
import subprocess
import re
dockerdir = '/var/lib/docker'
volumesdir = os.path.join(dockerdir, 'volumes')

build

Clone and build Node for analysis:

$ git clone https://github.com/joyent/node.git
$ cd node
$ export GYP_DEFINES="v8_enable_disassembler=1"
$ ./configure
$ make -j4