Skip to content

Instantly share code, notes, and snippets.

View RafalSladek's full-sized avatar

Rafal Sladek RafalSladek

View GitHub Profile
@RafalSladek
RafalSladek / .gitconfig
Created March 8, 2021 13:51
my git config
➜ ~ cat .gitconfig
[user]
name = UserName
email = Usernamne@email.com
[push]
default = matching
[ui]
color = auto
[alias]
pr = pull --rebase
#!/bin/bash
cat /proc/cpuinfo
cat /sys/firmware/devicetree/base/model
echo ''
vcgencmd measure_temp
vcgencmd measure_volts
vcgencmd measure_clock arm
@RafalSladek
RafalSladek / removeAllBranchesExceptMaster.sh
Created May 7, 2019 14:51
Remove all your local git branches but keep master
#!/bin/bash
git branch | grep -v "master" | xargs git branch -D
@RafalSladek
RafalSladek / clean_docker.sh
Last active May 16, 2020 13:03
script to clean up unused images containers networks volumes - cleanup docker
#!/bin/bash
echo "remove docker containers..."
docker ps
docker ps -a
docker rm $(docker ps -qa --no-trunc --filter "status=exited")
echo "remove docker images..."
docker images
docker rmi $(docker images --filter "dangling=true" -q --no-trunc)
docker images | grep "none"
@RafalSladek
RafalSladek / install_openjdk8.sh
Created January 8, 2019 10:56
install open jdk 8 on mac with brew
brew tap AdoptOpenJDK/openjdk
brew cask install adoptopenjdk8
@RafalSladek
RafalSladek / remove_java_jdk.sh
Last active January 9, 2019 14:25
remove jdk from mac
#Run this command to just remove the JDK
sudo rm -rf /Library/Java/JavaVirtualMachines/*
#Run these commands if you want to remove plugins
sudo rm -rf /Library/PreferencePanes/JavaControlPanel.prefPane
sudo rm -rf /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
# if you have more complications, please hava a look here - https://stackoverflow.com/questions/19039752/removing-java-8-jdk-from-mac#23092014
@RafalSladek
RafalSladek / runNevergreen.sh
Last active January 14, 2019 10:12
a bash script to start nevergreen ci monitor locally with docker
#!/bin/bash
if [[ -z ${NEVERGREEN_AES} ]];
then
echo "variable NEVERGREEN_AES is not set. Please put this aes key in your .bashrc or .profile"
exit -1;
else
docker stop nevergreen
docker rm -f nevergreen
docker rmi buildcanariesteam/nevergreen
@RafalSladek
RafalSladek / kms_helper.sh
Created November 5, 2018 11:49
How to de-/encrypt password with KMS
#!/bin/bash
## How to encrypt password with KMS?
aws kms encrypt --key-id <KMS_KEY_ID> --plaintext fileb://password.txt --output text --query CiphertextBlob
## How to decrypt password with KMS?
echo "<DECRYPTED_SECRET_HERE>" | base64 --decode > password.base64
aws kms decrypt --ciphertext-blob fileb://password.base64 --output text --query Plaintext | base64 --decode

Applied Functional Programming with Scala - Notes

Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x
#!/bin/bash
USERNAME=zen
if [ -z "$(getent passwd $USERNAME)" ]; then
useradd -m $USERNAME
USERPASS=$(tr -cd '[:alnum:]' < /dev/urandom | fold -w12 | head -n1)
echo "$USERNAME:$USERPASS" | chpasswd
echo "$USERNAME:$USERPASS" > /tme/$USERNAME
HOMEFOLDER=$(sudo -H -u $USERNAME bash -c 'echo $HOME')