Skip to content

Instantly share code, notes, and snippets.

View izinin's full-sized avatar

Igor Zinin izinin

View GitHub Profile
@izinin
izinin / Dockerfile
Created March 15, 2018 07:03
Dockerfile: dbase provision when docker stack being established
# ... YOUR Dockerfile definition here
# wait for dependecy ready
RUN curl -s https://raw.githubusercontent.com/eficode/wait-for/master/wait-for -o /tmp/wait-for
RUN chmod 754 /tmp/wait-for
RUN apt-get update
RUN apt-get install -y netcat
# docker inspect --format="{{json .State.Health}}" sakani-projects-graphql
HEALTHCHECK --start-period=30s --retries=10 --timeout=1m CMD \
@izinin
izinin / preemtible_kubernetes.md
Created January 6, 2018 15:21 — forked from rimusz/preemtible_kubernetes.md
kubernetes cluster w/ pre-emptible instances

Kubernetes clusters using preemtible instances

Motivation

People experimenting with kubernetes clusters on the GKE not necessarily have money to keep a full cluster on at all time. GKE clusters can be easily resized, but this still incurs in the full instance cost when the cluster is up.

Google has added preemptible instances that are ideal for many

@izinin
izinin / JSZip library use.js
Last active October 12, 2017 06:35
JSZip (https://stuk.github.io/jszip/) use for updating a zip archive. If the archive contains FName, its content will be updated, otherwise new item FName will be added
var JSZip = require("jszip");
var fs = require('fs');
module.exports = {
// Replaces or adds 'replacementFname' into archive 'zipFname' with
// content obtained from 'contentFname' file.
// Creates new file 'updated.zip' in the current directory
// for example :
// xxx.updatezip('test_suite.zip', 'scenario.xml', 'rooster/scenarios/rooster.xml')
@izinin
izinin / index.js
Created September 5, 2017 17:18
creating S3 static website from AWS CodeBuild pipeline
'use strict';
// https://github.com/aws/aws-sdk-js
// http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/creating-and-calling-service-objects.html
// http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/
// http://docs.amazonaws.cn/en_us/AWSJavaScriptSDK/guide/node-making-requests.html
var AWS = require('aws-sdk');
var s3 = new AWS.S3({
apiVersion: '2006-03-01'
@izinin
izinin / A* implementation
Created February 2, 2017 22:20
python A* implementation
from Queue import PriorityQueue
"""
matrix=[['#', '#', '#', '#', '#', '#', '#', '#', '#', '#'],
['@', '.', '#', '.', '.', '.', '.', '.', '.', '#'],
['#', '.', '.', '.', '#', '#', '.', '.', '.', '#'],
['#', '.', '.', '.', '#', '#', '.', '#', '.', '#'],
['#', '#', '.', '.', '#', '#', '.', '.', '.', '#'],
['#', '#', '#', '.', '#', '#', '.', '#', '#', '#'],
['#', '.', '.', '.', '.', '.', '.', '.', '.', '#'],
['#', '.', '.', '.', '.', '#', '#', '#', '.', '#'],
@izinin
izinin / utility.erl
Created April 8, 2016 08:15
Erlang: replacing 'null' value with specified replacement in hieracy list tree
%% @doc replaces 'null' value with specified replacement in hieracy list tree
%% list elements can contain tuples
-spec replace_null(Replacement :: term(), InputTree :: list(), Accumulator :: list()) -> Result when
Result :: list().
%% --------------------------------------------------------
%% manual testing :
%% > R = [[<<"username">>,<<"jid">>,<<"nick">>,<<"last">>,
%% <<"subscription">>,<<"ask">>,<<"askmessage">>,<<"server">>,
%% <<"subscribe">>,<<"type">>],
%% [{<<"XXXXXXXXXXX">>,<<"[email protected]">>,<<" ">>,
@izinin
izinin / sendmail.py
Created March 11, 2016 10:12
sending email with python
#!/usr/bin/python
import smtplib
import sys, getopt
import pdb
def main(argv):
helpMsg = """sendmail.py -c <smtp_srv> -o <smtp_port> -u <smtp_user> -p <smtp_passwd>
-s <mail_sender> -r <mail_recepients> -m <mail_msg>
"""
@izinin
izinin / aws_clean.py
Created January 19, 2016 10:06
cleaning AWS S3 with batch
#!/usr/bin/python
import sys, getopt
import subprocess
import string
import pdb
# install AWS cli https://aws.amazon.com/cli/
# usage example :
# python aws_clean.py -p "jongla/broadcast" -b "coverimagedevsg"