Skip to content

Instantly share code, notes, and snippets.

View costa's full-sized avatar

Costa Shapiro costa

View GitHub Profile
@costa
costa / Dockerfile
Created February 6, 2019 14:33
kafka rest proxy helm chart ssl disability workaround (a part of)
FROM confluentinc/cp-kafka-rest:5.0.1
# NOTE the `*store`s should not be source-controlled and should be password-protected,
# so upon the helm chart deployment, the values should include (along with image/Tag):
# cp-kafka-rest:
# configurationOverrides:
# ssl.keystore.password:
# ssl.truststore.password:
# ssl.key.password:
# the "*store"s should be password-protected and the passwords must be supplied upon deployment
@costa
costa / write-ingester-certs.sh
Created February 6, 2019 12:57
a starter script for client+server kafka rest proxy certificates+keystores
#!/bin/bash -e
INGESTER_DOMAIN_NAME="${INGESTER_DOMAIN_NAME:-$1}"
echo "CAUTION should be run from a secure directory"
if test -z "$INGESTER_DOMAIN_NAME"
then echo "needs INGESTER_DOMAIN_NAME"
exit 1
else echo "INGESTER_DOMAIN_NAME=$INGESTER_DOMAIN_NAME"
@costa
costa / gist:c0cd0e0433651594dff464f2d18d6a23
Last active February 7, 2019 11:27
disk space inspection
sudo find / -maxdepth 3 -print0 | xargs -0 sudo du -csh | grep 'G ' | tee /tmp/du
sudo bash -c 'rm -rf $HOME/../*/Library/Application\ Support/MobileSync/Backup'
sudo bash -c 'rm -rf $HOME/../*/Library/Arq'
sudo bash -c 'rm -rf $HOME/../*/Library/Application\ Support/IDriveforMac'
sudo bash -c 'rm -rf $HOME/../*/Library/Caches/*'
sudo bash -c 'rm -rf $HOME/../*/.rvm'
sudo bash -c 'rm -rf $HOME/../*/var/tmp'
sudo bash -c 'rm -rf $HOME/../*/.Trash/*' # dotfiles are not deleted
@costa
costa / dev-status.sh
Created October 6, 2018 01:16
primitive dev (git) status reporting script
#!/bin/bash -e
function proj_status() {
git fetch --all
git status
git branch
git stash list
}
for git in $( find . -name .git -type d )
@costa
costa / prime_sieve.exs
Last active September 1, 2018 12:32
A (naive) implementation of (concurrent) prime sieve in Elixir, inspired by https://golang.org/doc/play/sieve.go
defmodule Prime do
defp create_prime_filter(prime, printer) do
send printer, prime
spawn fn -> filter_prime_rec prime, printer, nil end
end
defp filter_prime_rec(prime, printer, next) do
receive do
number ->
@costa
costa / costa_shapiro_resume.md
Created August 1, 2018 10:12
Costa Shapiro's résumé

Costa started coding in C before he owned a PC and before starting his studies at the Bosmat high school's "Automated Data Processing" program. Then, turning his passion into profession, he got his first job (and his first project of his own) in the middle of his high school studies. After that, Costa was rarely not doing something new and exciting: educational robots (Technion), micro-satellites (Technion), first internet tools (NetManage), first "smart" phones (Qualcomm), first billion-transistor processors (Intel), his own take on web content distribution (startup), first web content analysis (Nielsen), and other projects of various sizes and areas of application, including startup consultancy too. Having rich experience and solid academic background (M.Sc. Technion CS, hon.),

@costa
costa / init.el
Created December 19, 2017 12:44
~/.spacemacs.d/init.el
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
@costa
costa / Dockerfile
Created September 7, 2017 11:22
A (containerised) web wrapper for dumb python scripts (for docker, system tests and profit) for dummies
FROM python:2.7
WORKDIR /your-scripts
ADD requirements.web.txt .
RUN pip install -r requirements.web.txt
ADD requirements.txt .
RUN pip install -r requirements.txt
@costa
costa / it_if_spec_helper.rb
Created September 7, 2017 10:02
it_if you.do?(:system_tests).with(:rspec), "you find this useful", better_than_tags: true {...}
def it_if(condition, title, **opts, &block)
send((condition ? :it : :xit), title, **opts, &block)
end
@costa
costa / env.rb
Created July 30, 2017 12:32
`ENV` augmentation (to allow for `ENV.SOME_VAR` and `ENV.SOME_VAR!` instead of `... ENV['SOME_VAR'].blank?` etc)
def ENV.method_missing(symbol, *args)
return super unless args.length == 0 && symbol.to_s =~ /^([A-Z_][A-Z_0]*)(!?)$/
self[$1].tap{|val| fail "needs #{$1} env" unless $2.empty? || !val.to_s.empty?}
end