Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View yigitozkavci's full-sized avatar
🤠

Yiğit Özkavcı yigitozkavci

🤠
  • Google
  • London, UK
View GitHub Profile
@yigitozkavci
yigitozkavci / Broadcaster.md
Last active November 4, 2019 13:35
Broadcaster Interview Question

Broadcaster

Create a binary that, when executed, links itself to other broadcaster binaries that are running. This binary is able to receive instructions to display and broadcast a message to other broadcasters it's linked to.

The resulting graph of linked broadcasters should always constitute a spanning tree, in other words, all of them should be connected and there shouldn't be any redundant edges.

Example

$ broadcaster --port 8000
Started listening for instructions on :8000.
@yigitozkavci
yigitozkavci / phon.sh
Created July 15, 2018 09:15
Small script for finding phonetic description of words
phon() {
f=$(mktemp)
curl -sX GET -H 'User-Agent: Mozilla/4.0' "http://www.phonemicchart.com/transcribe/?w=$1" > "$f"
xmllint --xpath "//center/span/text()" --html $f 2>/dev/null
rm $f
}
# Example usage:
# $ phon merry
# > /'mærɪ/
Require Coq.Lists.List.
Require Coq.Program.Basics.
(* Utility Functions *)
Inductive Maybe (A : Type) : Type :=
| Nothing : Maybe A
| Just : A -> Maybe A.
Inductive stackValue : Set :=
@yigitozkavci
yigitozkavci / swap_ubuntu
Created July 19, 2017 07:12
Add and configure swap space on ubuntu
SWAP_SIZE="1G" # Generally x1 or x2 of your memory is sufficient
sudo fallocate -l "$SWAP_SIZE" /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
echo 'vm.swappiness=10' | sudo tee -a /etc/sysctl.conf
echo 'vm.vfs_cache_pressure=50' | sudo tee -a /etc/sysctl.conf
@yigitozkavci
yigitozkavci / unrootify_ubuntu
Last active August 29, 2019 17:22
Unrootify yourself in a newly created ubuntu instance
export USERNAME=yigit
echo -e "\n\nAllowUsers root $USERNAME" >> /etc/ssh/sshd_config
sudo service ssh restart
mkdir -p /home/$USERNAME/.ssh
cp /root/.ssh/authorized_keys /home/$USERNAME/.ssh
sudo adduser $USERNAME
sudo adduser $USERNAME sudo
sudo chown -R $USERNAME /home/$USERNAME
# To make this user a ssh user