Skip to content

Instantly share code, notes, and snippets.

View olebedev's full-sized avatar
🏄‍♂️
🌊 🌊 🌊

Oleg Lebedev olebedev

🏄‍♂️
🌊 🌊 🌊
View GitHub Profile
#!/bin/sh
# OPTIONAL FLAGS:
#
# -geoip true
# this will install maxmind geoip and auto update crontab file
#
# -cloudwatch true
# this will install aws cloud watch metrics and send them to aws dashboard
#
@olebedev
olebedev / tiny closure Promise.js
Last active August 29, 2015 14:26 — forked from briancavalier/tiny closure Promise.js
A closure version of my mod (https://gist.github.com/814313) to unscriptable's tiny promise (https://gist.github.com/814052/)
function Promise() {
var callbacks = [],
promise = {
resolve: resolve,
reject: reject,
then: then,
safe: {
then: function safeThen(resolve, reject) {
promise.then(resolve, reject);
}
@olebedev
olebedev / tmux-cheatsheet.markdown
Last active August 29, 2015 14:27 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@olebedev
olebedev / wercker.yml
Created October 14, 2015 17:27 — forked from mies/wercker.yml
default golang wercker.yml
box: wercker/golang
# Add services here
# Build definition
build:
# The steps that will be executed on build
steps:
# Sets the go workspace and places you package
# at the right place in the workspace tree
- setup-go-workspace
@olebedev
olebedev / hn_seach.js
Created November 2, 2015 16:59 — forked from meiamsome/hn_search.js
hn job query search
// takes arguments and produces an array of functions that accept context
function handle_args() {
var args = Array.prototype.slice.call(arguments);
return args.map(function(arg) {
if(arg instanceof Function) return arg; // Presumably already a contex-accepting function.
if(arg instanceof Array) return and.apply(this, arg); // make arrays behave as and.
// Presuming a string, build a function to check.
var my_regex = new RegExp(arg.toString(), 'i');
return function(context) {
return context.search(my_regex) > -1;
@olebedev
olebedev / wercker-dokku-deploy.yml
Created February 18, 2016 10:31 — forked from ademuk/wercker-dokku-deploy.yml
Wercker Dokku deploy
deploy:
steps:
- add-to-known_hosts:
hostname: $HOSTNAME
- add-ssh-key:
keyname: KEY
- script:
name: Push to dokku
code: |
git remote add dokku dokku@$HOSTNAME:$APP
@olebedev
olebedev / Makefile
Last active April 1, 2016 13:50
Makefile rule to extract gettetx/ngettext calls from Golang templates and source files
XGETTEXT_FLAGS = --no-wrap --language=c --from-code=UTF-8 --output=- -
$(POT_FILE): $(TEMPLATES) $(filter-out $(BINDATA), $(GO_FILES))
@cat $? \
| grep -i gettext \
| sed -e "s/ngettext \"\([^\"]*\)\".\"\([^\"]*\)\".\(.*\) }}/ngettext(\"\1\", \"\2\", \3) }}/g" \
| sed -e "s/[^n]gettext \"\(.*\)\"/ gettext(\"\1\")/g" \
| sed -e "s/NGetText(\([^\)]*\))/ ngettext(\1) /g" \
| sed -e "s/GetText(\([^\)]*\))/ gettext(\1) /g" \
| xgettext $(XGETTEXT_FLAGS) \
| sed -e '1,20d' \
//usr/bin/env go run $0 $@; exit
@olebedev
olebedev / building_micro_services.md
Created June 12, 2016 12:06
Note on tools for building micro-services based architecture: CI, CD, Cluster Management, etc

Tools for building microservices architecture (May 7, 2016)

We are obviously in the age of Microservices, Mobile first, Polyglot, post-Java JVM languages, GitHub and Docker uprise. In this world, Open Source usage dominates, and the speed of change is intense. Knowing the direction of DevOps tools and picking the right one for the project is crucial.

Terms

Continuous Integration is the practice of running your tests on a non-developer machine automatically everytime someone pushes new code into the source repository.

This has the tremendous advantage of always knowing if all tests work and getting fast feedback. The fast feedback is important so you always know right after you broke the build (introduced changes that made either the compile/build cycle or the tests fail) what you did that failed and how to revert it.

### My publicly-auditable identity:
https://keybase.io/olebedev
### From the command line:
Consider the [keybase command line program](https://keybase.io/download).
```bash
# look me up