Skip to content

Instantly share code, notes, and snippets.

View aliva's full-sized avatar
🤖
Hello Humans!

Ali Vakilzade aliva

🤖
Hello Humans!
View GitHub Profile
@aliva
aliva / daemon.json
Created May 12, 2019 11:59
docker daemon.json - registry mirrors which work in iran
{
"registry-mirrors": ["https://registry.docker-cn.com", "http://repo.docker.ir:5000"]
}
@aliva
aliva / copy.sh
Created April 13, 2019 10:30
add ssh key to authorized_keys in all servers (give access to all server for a new key)
#!/bin/bash
# create a file named key which contains the public key for new user
export SERVERS="ip1 ip2 ip3"
for server in $SERVERS
do
echo "============="
echo $server
@aliva
aliva / redis-all-keys.sh
Created February 16, 2019 08:36
print all redis keys
seq 16 | xargs -I{} sh -c 'echo ===== {} ===== && redis-cli -n {} keys "*"'
kubectl get pods --no-headers -o custom-columns=":metadata.name" | xargs -I{} sh -c "kubectl logs {} > {}.txt"
#!/bin/bash
# curl link-to-raw | bash
set -e
export DEBIAN_FRONTEND=noninteractive
apt-get -y update
apt-get -y upgrade
apt-get -y install docker.io
@aliva
aliva / parallel_queue.py
Created October 27, 2018 08:24
A sample code for python ParallelQueue
import queue
import threading
import time
from random import randint
class ParallelQueue:
def _worker(self, i):
print("Starting worker: ", i)
while True:
#!/bin/bash
function displaytime {
local T=`echo $1 / 1 | bc`
local D=$((T/60/60/24))
local H=$((T/60/60%24))
local M=$((T/60%60))
local S=$((T%60))
(( $D > 0 )) && printf '%d days ' $D
(( $H > 0 )) && printf '%d hours ' $H
export PYTHONDONTWRITEBYTECODE=1
mediaplayer-remote play-pause
mediaplayer-remote next
mediaplayer-remote prev
mediaplayer-remote stop
#!/bin/bash
TIMEOUT=1
function do_action(){
player=$1
action=$2
# check if player is running
if ! pgrep $player &>/dev/null