Skip to content

Instantly share code, notes, and snippets.

View focks's full-sized avatar
🎯
Focusing

Chandan Kumar Singha focks

🎯
Focusing
View GitHub Profile
my_project/
  build/
  deployments/
  cmd/
  pkg/
  README.md
#!/usr/bin/env groovy
def chngs = "["
// gather the file changes
def changeSets = currentBuild.changeSets
for (int i = 0; i < changeSets.size(); i++) {
def entries = changeSets[i].items
for (int j = 0; j < entries.length; j++) {
def entry = entries[j]
def files = new ArrayList(entry.affectedFiles)
@focks
focks / st.md
Last active December 4, 2018 11:26

hello
world

@focks
focks / rox.py
Created October 24, 2018 14:29
reactive
>>> import multiprocessing
>>> import random
>>> import time
>>> from threading import current_thread
>>> from rx import Observable
>>> from rx.concurrency import ThreadPoolScheduler
>>> optimal_thread_count = multiprocessing.cpu_count()
>>> pool_scheduler = ThreadPoolScheduler(optimal_thread_count+1)
@focks
focks / introrx.md
Created October 8, 2018 10:55 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: vapp-gateway
spec:
selector:
istio: ingressgateway
servers:
- port:
number: 80
@focks
focks / test.yaml
Last active September 23, 2018 13:12
apiVersion: config.istio.io/v1alpha2
kind: listchecker
metadata:
name: whitelist
spec:
# providerUrl: ordinarily black and white lists are maintained
# externally and fetched asynchronously using the providerUrl.
overrides: ["v1", "v2"] # overrides provide a static list
blacklist: false
podTemplate(label: 'bashpod', containers: [
containerTemplate(name: 'bash', image: 'bash:latest', ttyEnabled: true)
]) {
node('bashpod') {
stage('play') {
checkout scm
container('bash') {
print "checking payload"
MAX_MSG_LEN = 100
@focks
focks / zipfolder.py
Created August 30, 2018 09:48
zip a folder using python
def zipdir(path, ziph):
# ziph is zipfile handle
for root, dirs, files in os.walk(path):
for file in files:
fname = os.path.join(root.replace(APIPROXY_PATH, ''), file)
ziph.write(os.path.join(root, file), fname)
# zip the content
zipf = zipfile.ZipFile('dev.zip', 'w')
zipdir(APIPROXY_PATH, zipf)
zipf.close()
#include <iostream>
#include <vector>
using namespace std;
int min(int x, int y, int z){
return min(x, min(y, z));
}
int max(int x, int y, int z){
return max(x, max(y, z));