Skip to content

Instantly share code, notes, and snippets.

@johan149
johan149 / sping
Last active January 26, 2023 08:58
#!/bin/bash
# to use run the following
# wget -qO - https://gist.githubusercontent.com/johan149/754f95421610f62f585d863f216e0b23/raw/2578b078826e66c59e0bb68384c67aac67f0016d/sping | bash
declare -a list
list[0]=nj-us-ping.vultr.com
list[1]=il-us-ping.vultr.com
list[2]=ga-us-ping.vultr.com
@johan149
johan149 / ping.py
Last active January 26, 2023 09:58
import urllib.request, subprocess, json, time, sys, re
pings = 1
batchSize = 100
mode = "ipv4"
target = ""
if len(sys.argv) >= 2:
args = re.findall("((-c|-p|-l)\s?([0-9A-Za-z]+)|-6)",' '.join(sys.argv[1:]))
for arg in args:
#!/bin/bash
check_internet_connection() {
return $(ping -c 1 www.google.com > /dev/null)
}
while [ 1 ]; do
check_internet_connection
# already have internet connection
if [ $? -eq 0 ]; then
echo "$(date +%Y-%m-%d\ %H:%M:%S) "internet connection state online"
# SRT config.
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
http_api {
enabled on;
listen 1985;
@johan149
johan149 / install_docker_debian.sh
Last active July 2, 2023 06:52
install docker & docker compose in debian
# run this on the clean CLI
# bash <(curl -sL https://gist.githubusercontent.com/johan149/ee626c4b524b744c1a307255d6c0bf26/raw/1b3cb0533156744ab4cb46be9768341218e1a873/install_docker_debian.sh)
# install docker
#!/bin/bash
apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common sudo
curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg | sudo apt-key add -
# bash <(curl -sL https://gist.githubusercontent.com/johan149/dd4b23649f95c48d65ee106e9c463386/raw/fc9f88db1fcfbb1e79e6a6c8197ac254471d2977/install_cuda_12.2.0_ubuntu2204.sh)
# Remove current cuda version
sudo apt-get --purge remove -y "*cuda*" "*cublas*" "*cufft*" "*cufile*" "*curand*" "*cusolver*" "*cusparse*" "*gds-tools*" "*npp*" "*nvjpeg*" "nsight*" "*nvvm*"
sudo apt-get --purge remove -y "*nvidia*" "libxnvctrl*"
sudo apt-get autoremove -y
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-ubuntu2204.pin
sudo mv cuda-ubuntu2204.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/12.2.0/local_installers/cuda-repo-ubuntu2204-12-2-local_12.2.0-535.54.03-1_amd64.deb
# run this on the clean CLI
# bash <(curl -sL https://gist.githubusercontent.com/johan149/8f87901f55d91edc662b869fbe0d9d45/raw/524f9c1422c73617eceeb3ad309ae3c8ae41bd10/install_docker_ubuntu.sh)
#!/bin/sh
set -o errexit
set -o nounset
IFS=$(printf '\n\t')