Skip to content

Instantly share code, notes, and snippets.

View alivx's full-sized avatar
😇
our business is life itself

Ali alivx

😇
our business is life itself
View GitHub Profile
@alivx
alivx / Install k8s.md
Created January 1, 2021 20:37
Install k8s

sudo apt update sudo apt -y install curl apt-transport-https curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list sudo apt update sudo apt -y install vim git curl wget kubelet kubeadm kubectl sudo apt-mark hold kubelet kubeadm kubectl sudo sed -i '/ swap / s/^(.*)$/#\1/g' /etc/fstab sudo swapoff -a sudo modprobe overlay

@alivx
alivx / alpine-linux-timezone
Created December 2, 2020 16:31
alpine-linux-timezone
Timezone setting is now handled by Setup-alpine#setup-timezone
Note: Only for NON uclibc installs!!!
glibc based installs use different timezone setup.
apk add tzdata
ls /usr/share/zoneinfo
Suppose you want to use Brussels First copy the proper zone to localtime
cp /usr/share/zoneinfo/Europe/Brussels /etc/localtime
@alivx
alivx / Mysql uniqe Vowels
Last active January 17, 2024 17:15
Query the list of CITY names starting with vowels (i.e., a, e, i, o, or u) from STATION. Your result cannot contain duplicates.
Start with
select DISTINCT CITY from STATION where CITY rlike '^[a,e,i,o,u]';
End with
select DISTINCT CITY from STATION where CITY rlike '[a,e,i,o,u]$';
Both Start and end
select DISTINCT CITY from STATION where CITY rlike '^[a,e,i,o,u].*[a,e,i,o,u]$';
SELECT DISTINCT CITY from STATION where CITY REGEXP '^[^aeiou].*[^aeiou]$';
@alivx
alivx / jenkins-server-docker-compose.yaml
Created November 22, 2020 20:44
Jenkins Server Docker
version: "3"
services:
jenkins:
build: .
user: root
volumes:
- /jenkins/data:/var/jenkins_home
- /jenkins/artifacts:/var/jenkins_artifacts
- /var/run/docker.sock:/var/run/docker.sock
@alivx
alivx / nginx.conf
Created November 4, 2020 13:11 — forked from mtigas/nginx.conf
Nginx configuration for securedrop.propublica.org. (Based on Ubuntu 13.10 / Nginx 1.4.1 default config.)
# This configuration file is provided on an "as is" basis,
# with no warranties or representations, and any use of it
# is at the user's own risk.
#
# You will need to edit domain name information, IP addresses for
# redirection (at the bottom), SSL certificate and key paths, and
# the "Public-Key-Pins" header. Search for any instance of "TODO".
user www-data;
worker_processes 4;
@alivx
alivx / multiSSH.md
Created October 15, 2020 22:54
Use multiple ssh-keys for different GitHub accounts on the same computer

Create new ssh key

ssh-keygen -t rsa -b 4096 -C "[email protected]"

~/.ssh/config

# Personal GitHub account
# input a pcap file from standard input
INPUT_PCAP_FILE=$1
HEADER=y
SEPARATOR=,
QUOTE=d
# display standard output
tshark \
-r ${INPUT_PCAP_FILE} \
@alivx
alivx / gist:7807c123d32377c56ea7d5b5d98e7c76
Created September 29, 2020 20:46
Convert Doc to MD with media
pandoc -o output.md --extract-media=./ inputfile.docx
@alivx
alivx / cleanupGitHistory
Created September 29, 2020 20:17
Cleanup git history
git filter-branch --force --index-filter "git rm --cached --ignore-unmatch filePath" --prune-empty --tag-name-filter cat -- --all
@alivx
alivx / Data fixes
Last active September 28, 2020 19:47
#Trim spaces
ali.rename(columns=lambda x: x.strip(), inplace=True)
#Fill merged cells with upper head
ali = mini.fillna(method='ffill', axis=0)
#Replace nan with zero
support['xx'] = support['xx'].replace(np.nan, 0)