Skip to content

Instantly share code, notes, and snippets.

View ittp's full-sized avatar

tp ittp

  • Saint-Petersburg
View GitHub Profile
#!/bin/bash
# -x used to show output
# create functions --------------------------------------------------------------------------------
function readCredentials() {
# Needs at least one extra line at the bottom of the
# file below the last desired line to read correctly
while IFS=: read -r key value
do
#If the file doesn't exist, create the folder and the file in it.
if [ ! -f "$FILE" ]; then
mkdir -p $FOLDER
touch "$FOLDER/$FILE"
fi
insert() {
file=${1}
@davidfowl
davidfowl / MinimalAPIs.md
Last active June 28, 2024 17:42
Minimal APIs at a glance
@mehmetahsen
mehmetahsen / telegram.sh
Created May 7, 2021 20:46
Poor man's Telegram notifier
#!/bin/bash
# Bash Import/Source script
# Prints/Sends start/error/end messages
set -o pipefail
set -o errtrace
# Have below variables set
TELEGRAM_BOT_TOKEN=''
TELEGRAM_CHAT_ID=''
@kotashiratsuka
kotashiratsuka / setup.sh
Last active June 21, 2022 07:09
setup.sh
#!/bin/sh -x
# curl -L https://gist.github.com/kotashiratsuka/7bee5455b80b573a2b471ca608eccbd4/raw | sh
cd
test .ssh || mkdir -m 700 .ssh
( umask 077; touch .ssh/authorized_keys )
curl -L https://github.com/kotashiratsuka.keys | grep ed25519 >> .ssh/authorized_keys
@maxgfr
maxgfr / bash.md
Last active July 13, 2023 14:41
Bash / git config

Bash / Git config

Reduce your push time

Just edit your ~/.zshrc by adding at the bottom this line :

push() {
    git add -A && git commit -m $1 $2 && git push $2
}
@steelywing
steelywing / EnableSSH.js
Created January 31, 2021 05:51
Enable RedMi 2100 SSH access
// Work for RedMi 2100 firmware 2.0.23
// http://cdn.cnbj1.fds.api.mi-img.com/xiaoqiang/rom/rm2100/miwifi_rm2100_all_fb720_2.0.23.bin
function getSTOK() {
let match = location.href.match(/;stok=(.*?)\//);
if (!match) {
return null;
}
return match[1];
}
#!/bin/sh
# non-interactive kde installer for alpine
# apk add curl && curl -L https://cutt.ly/alpine_kde | sh
echo "I will make Alpine Linux a Desktop Linux.. ."
## Desktop user
@heyibrahimkhan
heyibrahimkhan / squid-deployment-script.sh
Last active March 19, 2022 12:41
Deploy squid proxy with basic authentication
sudo apt install squid squid-deb-proxy squid-deb-proxy-client squidclient apache2-utils && sudo service squid start && sudo rm -rfv /etc/squid/squid.conf;
# Write squid.conf to /etc/squid.squid.conf
echo "# apt-get install squid apache2-utils" | sudo tee -a /etc/squid/squid.conf
echo "# htpasswd -c /etc/squid/.htpasswd user_name" | sudo tee -a /etc/squid/squid.conf
echo "# systemctl restart squid" | sudo tee -a /etc/squid/squid.conf
echo "" | sudo tee -a /etc/squid/squid.conf
echo "acl CONNECT method CONNECT" | sudo tee -a /etc/squid/squid.conf
echo "" | sudo tee -a /etc/squid/squid.conf
echo "# line 989: add follows for Basic auth" | sudo tee -a /etc/squid/squid.conf
echo "auth_param basic program /usr/lib/squid/basic_ncsa_auth /etc/squid/.htpasswd" | sudo tee -a /etc/squid/squid.conf