Skip to content

Instantly share code, notes, and snippets.

View izinin's full-sized avatar

Igor Zinin izinin

View GitHub Profile
@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"
@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 / 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">>,<<"AAAAAAAAAAA@im.domain.im">>,<<" ">>,
@izinin
izinin / A* implementation
Created February 2, 2017 22:20
python A* implementation
from Queue import PriorityQueue
"""
matrix=[['#', '#', '#', '#', '#', '#', '#', '#', '#', '#'],
['@', '.', '#', '.', '.', '.', '.', '.', '.', '#'],
['#', '.', '.', '.', '#', '#', '.', '.', '.', '#'],
['#', '.', '.', '.', '#', '#', '.', '#', '.', '#'],
['#', '#', '.', '.', '#', '#', '.', '.', '.', '#'],
['#', '#', '#', '.', '#', '#', '.', '#', '#', '#'],
['#', '.', '.', '.', '.', '.', '.', '.', '.', '#'],
['#', '.', '.', '.', '.', '#', '#', '#', '.', '#'],
@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 / 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 / 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 / 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 / ndk_basics.md
Created December 30, 2018 14:14 — forked from okamayana/ndk_basics.md
Android Studio: Writing and calling JNI functions

Purpose

Writing JNI functions

  1. Create a new Android Studio project. To do so, select File -> New -> New Project.
@izinin
izinin / Useful netcat examples on Linux.md
Created August 14, 2020 13:33 — forked from lenciel/Useful netcat examples on Linux.md
Useful netcat examples on Linux

Often referred to as the "swiss army of knife" for TCP/IP networking, [Netcat][1] is an extremely versatile Linux utility that allows you to do anything under the sun using TCP/UDP sockets. It is one of the most favorite tools for system admins when they need to do networking related troubleshooting and experimentation.

In this tutorial, I am sharing a few useful netcat examples, although the sky is the limit when it comes to possible netcat use cases. If you are using netcat regularly, feel free to share your use case.

Note that when you are binding to well-known ports (0-1023) with nc, you need root privilege. Otherwise, run nc as a normal user.

1. Test if a particular TCP port of a remote host is open.

$ nc -vn 192.168.233.208 5000