Skip to content

Instantly share code, notes, and snippets.

Avatar

Oleg Chunikhin olegch

View GitHub Profile
View etcd-testing.md

This is just an example that will only work for specific network interfaces and addresses. Modify as needed.

Create data directories for etcd members:

mkdir -p e{0,1,2}

Remove data directories:

@olegch
olegch / load-cloudformation-jyaml.js
Created Feb 9, 2017
Loading a CloudFormation yaml file with custom tags with js-yaml in node.js
View load-cloudformation-jyaml.js
'use strict';
var fs = require('fs');
var yaml = require('js-yaml');
var inputStr = fs.readFileSync('../../out/aws-cloud-formation-template-1.template', {encoding: 'UTF-8'});
var CF_SCHEMA = yaml.Schema.create([
new yaml.Type('!Ref', { kind: 'scalar', construct: function (data) { return { 'Ref': data }; } }),
new yaml.Type('!Equals', { kind: 'sequence', construct: function (data) { return { 'Fn::Equals': data }; } }),
View keybase.md

Keybase proof

I hereby claim:

  • I am olegch on github.
  • I am olegch (https://keybase.io/olegch) on keybase.
  • I have a public key whose fingerprint is 141E A6E1 E841 95DC B6A5 48E2 F41A 7B57 AEA3 18AB

To claim this, I am signing this object:

@olegch
olegch / example-template
Last active Jun 13, 2016
Simple template engine with bash
View example-template
Hello: X=$X
Hello: X=$X'''
Hello: X="$X"
Hello: X=$X "kjh
kjd"
$(date)
@olegch
olegch / oc-cut.py
Created May 6, 2016
Batch split of multiple image files in half in GIMP
View oc-cut.py
#!/usr/bin/env python
import math
from gimpfu import *
import os
import re
import sys
sys.stderr = open('C:/Temp/python-fu-output.txt','a')
@olegch
olegch / 0_reuse_code.js
Created Apr 6, 2016
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@olegch
olegch / subscript.groovy
Last active Aug 29, 2015
running a groovy subscript from a groovy script
View subscript.groovy
// parse script by file name dynamically
new GroovyShell(binding).parse(new File("${context.serviceDirectory}/test_script.groovy")).run()
// run script statically linking
new test_script(binding).run()
@olegch
olegch / find in files and replace.sh
Last active Dec 24, 2021
Find files skipping some directories and make global replacement
View find in files and replace.sh
find . -path ./.git -prune -o -path */target -prune -o -path ./binary -prune -o -type f -print | xargs sed -i 's/1\.6\.0-SNAPSHOT/1.7.0-SNAPSHOT/g'
@olegch
olegch / vim show whitespaces
Last active Dec 13, 2015
vim show whitespaces
View vim show whitespaces
:set listchars=eol:$,tab:>-,trail:~,extends:>,precedes:<
:set list