Skip to content

Instantly share code, notes, and snippets.

View ksindi's full-sized avatar
🚀
Shipping

Kamil Sindi ksindi

🚀
Shipping
View GitHub Profile
@ksindi
ksindi / docker-ssh-forward.bash
Created October 29, 2018 01:10 — forked from d11wtq/docker-ssh-forward.bash
How to SSH agent forward into a docker container
docker run -rm -t -i -v $(dirname $SSH_AUTH_SOCK) -e SSH_AUTH_SOCK=$SSH_AUTH_SOCK ubuntu /bin/bash
@ksindi
ksindi / gh-deploy-clone.sh
Created September 29, 2018 02:57 — forked from blvz/gh-deploy-clone.sh
Creates a deploy key and clones the repository.
#!/usr/bin/env bash
read -r -d '' usage << EOM
Usage:
gh-deploy-clone user/repo [ENVIRONMENT]
EOM
[ -z "$1" ] && echo && echo "$usage" && echo && exit 1
@ksindi
ksindi / example.py
Created August 14, 2018 13:25 — forked from 1st1/example.py
asyncio queues example
import asyncio
import random
import time
async def worker(name, queue):
while True:
# Get a "work item" out of the queue.
sleep_for = await queue.get()
@ksindi
ksindi / postgres_to_kafka.sh
Created July 12, 2018 12:43 — forked from tilakpatidar/postgres_to_kafka.sh
Postgres to Kafka streaming using debezium
# Run postgres instance
docker run --name postgres -p 5000:5432 debezium/postgres
# Run zookeeper instance
docker run -it --name zookeeper -p 2181:2181 -p 2888:2888 -p 3888:3888 debezium/zookeeper
# Run kafka instance
docker run -it --name kafka -p 9092:9092 --link zookeeper:zookeeper debezium/kafka
# Run kafka connect
get_ipython().magic('matplotlib inline')
import datetime
import numpy as np
import pandas as pd
import seaborn as sns
import pandas_datareader.data as web
sns.set()
@ksindi
ksindi / author_share.sh
Last active April 23, 2018 22:22
Top authors by number of lines committed
git ls-tree -rz --name-only HEAD -- . | xargs -0n1 git blame --line-porcelain HEAD -- | grep -aoP "(?<=^author ).*" | sort | uniq -c | sort -rnk1
"""Plot histogram of repo age in months."""
import os
import pandas as pd
import numpy as np
# pip install pygithub
from github import Github
# for jupyter notebook
# import seaborn as sns
@ksindi
ksindi / mock_now.py
Created February 2, 2018 23:20
Mock datetime.datetime.now
import datetime
def mock_now(now):
from datetime import datetime
class FakeDateType(type):
def __instancecheck__(self, instance):
return isinstance(instance, datetime)
@ksindi
ksindi / load_jpeg_with_tensorflow.py
Created January 1, 2018 21:47 — forked from eerwitt/load_jpeg_with_tensorflow.py
Example loading multiple JPEG files with TensorFlow and make them available as Tensors with the shape [[R, G, B], ... ].
# Typical setup to include TensorFlow.
import tensorflow as tf
# Make a queue of file names including all the JPEG images files in the relative
# image directory.
filename_queue = tf.train.string_input_producer(
tf.train.match_filenames_once("./images/*.jpg"))
# Read an entire image file which is required since they're JPEGs, if the images
# are too large they could be split in advance to smaller files or use the Fixed
[alias]
delete-merged-branches = "!f() { git checkout --quiet master && git branch --merged | grep --invert-match '\\*' | xargs -n 1 git branch --delete; git checkout --quiet @{-1}; }; f" # http://stackoverflow.com/a/6127884/2624466