Skip to content

Instantly share code, notes, and snippets.

View wingkwong's full-sized avatar
👁️‍🗨️
Focusing

աӄա wingkwong

👁️‍🗨️
Focusing
View GitHub Profile
@wingkwong
wingkwong / kill-kinsing.sh
Created February 6, 2024 06:42
kill-kinsing.sh
#!/bin/sh
kill $(pgrep kdevtmp);
kill $(pgrep kinsing);
find / -iname kdevtmpfsi -exec rm -fv {} \;
find / -iname kinsing -exec rm -fv {} \;
rm /tmp/kdevtmp*;
rm /tmp/kinsing*;
@wingkwong
wingkwong / git-main2master.sh
Created February 18, 2022 03:36
Update main to master on your local env
git branch -m main master
git fetch origin
git branch -u origin/master master
git remote set-head origin -a
@wingkwong
wingkwong / buildspec.yml
Created October 13, 2021 15:45
Fixing "Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?" on AWS CodeBuild with a custom docker image
version: 0.2
phases:
install:
commands:
- nohup /usr/local/bin/dockerd --host=unix:///var/run/docker.sock --host=tcp://127.0.0.1:2375 --storage-driver=overlay2 &
# If the base operating system is Alpine Linux, in the buildspec.yml add the -t argument to timeout:
- timeout 15 sh -c "until docker info; do echo .; sleep 1; done"
pre_build:
commands:
@wingkwong
wingkwong / install.sh
Last active May 19, 2023 15:54
Setting up Airflow in AWS Cloud9 (min requirement: t2.large)
# setup docker-compose
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
# setup airflow 1.10.14
git clone https://github.com/xnuinside/airflow_in_docker_compose
cd airflow_in_docker_compose
docker-compose -f docker-compose-with-celery-executor.yml up --build
@wingkwong
wingkwong / paginate.js
Created May 19, 2021 05:40
Paginate JSON object
var paginate = function(page, limit) {
page = page || DEFAULT_PAGE
limit = limit || DEFAULT_LIMIT
return json_obj.slice((page - 1) * limit).slice(0, limit)
}
@wingkwong
wingkwong / install-aws-cli-on-centos7.sh
Created April 9, 2021 04:23
Install AWS CLI on CentOS 7
curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
export PATH=~/bin:$PATH
# verify
aws --version
@wingkwong
wingkwong / docker-ce-installation-centos-7.sh
Created April 8, 2021 09:16
Docker CE installation on Centos 7
sudo -i
yum check-update
yum update -y
yum install epel-release -y
reboot
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install docker-ce docker-ce-cli containerd.io -y
systemctl start docker
systemctl status docker
@wingkwong
wingkwong / pre-receive-hook.sh
Created March 15, 2021 03:32
A pre-receive hook script to prevent someone to commit certain files
#!/bin/sh
# Check to see if this is the first commit in the repository or not
if git rev-parse --verify HEAD >/dev/null 2>&1
then
# We compare our changes against the previous commit
against=HEAD^
else
# Initial commit: diff against an empty tree object
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
@wingkwong
wingkwong / About.md
Last active April 22, 2024 04:58
About.md

Hello World!

@wingkwong
wingkwong / merge.sh
Created August 26, 2020 13:40
Merging other repositories to an existing one
git remote add -f foo https://github.com/wingkwong/foo.git
git remote add -f bar https://github.com/wingkwong/bar.git
git remote add -f baz https://github.com/wingkwong/baz.git
git merge foo/master --allow-unrelated-histories
git merge bar/master --allow-unrelated-histories
git merge baz/master --allow-unrelated-histories