Skip to content

Instantly share code, notes, and snippets.

View costa's full-sized avatar

Costa Shapiro costa

View GitHub Profile
@costa
costa / docker-compose.yml
Last active July 23, 2021 07:12
Sample Docker Compose configuration for "staging" tests with OpenVPN
version: '3.4'
services:
open-vpn:
image: dperson/openvpn-client
cap_add:
- net_admin
devices:
- /dev/net/tun
dns: 8.8.4.4 # NOTE not sure how to make this generic
command: -d -a "$OVPN_USER;$OVPN_OTP"
@costa
costa / golang-docker-deps-up.sh
Last active April 13, 2020 10:23
Golang Module dependencies update with Docker
GOLANG_VERSION=1.14
docker run -v $(pwd)/go.mod:/b/go.mod -v $(pwd)/go.sum:/b/go.sum -w /build golang:$GOLANG_VERSION bash -c 'cp -a /b/go.mod /build/ && go mod downloa
d && cp -a /build/go.sum /b/'
@costa
costa / rust-docker-deps-up.sh
Last active April 11, 2020 15:01
Rust Cargo dependencies update with Docker
RUST_VERSION=1.42
docker run -v $(pwd)/Cargo.toml:/build/Cargo.toml -v $(pwd)/Cargo.lock:/build/Cargo.lock -w /build rust:$RUST_VERSION bash -c "mkdir src && touch src/main.rs && cargo update"
@costa
costa / map-section-to-esc-and-vice-versa-macos.sh
Created August 1, 2019 12:08
Map § (section sign) to esc (escape key) and vice versa (Apple UK keyboard, macOS 10.14, ABC input source)
hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000064,"HIDKeyboardModifierMappingDst":0x700000029},{"HIDKeyboardModifierMappingSrc":0x700000029,"HIDKeyboardModifierMappingDst":0x700000064}]}'
@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.),