Server
Remote server (eg. DigitalOcean, AWS) where the WireGuard Server will be running.
Peer
#!/bin/bash | |
function date_to_seconds() { | |
if [[ $# -lt 1 ]]; then | |
echo "Date argument missing" | |
echo "Usage: date_to_seconds date" | |
exit 1 | |
fi | |
remove_slash_date=$(echo $1 | sed 's/\//\-/g') |
function install_tmate () { | |
apt update | |
apt install -y locales-all openssh-client xz-utils | |
ls -al ~/ & mkdir ~/.ssh/ | |
wget https://github.com/tmate-io/tmate/releases/download/2.4.0/tmate-2.4.0-static-linux-amd64.tar.xz | |
tar xvf tmate-2.4.0-static-linux-amd64.tar.xz | |
mv tmate-2.4.0-static-linux-amd64/tmate /usr/bin/tmate | |
tmate -V | |
echo 'set +e' >/tmp/tmate.bashrc | |
ssh-keygen -q -t rsa -N "" -f ~/.ssh/id_rsa |
Add following in .zshrc
preexec() {
echo "[$(date +%d/%m/%Y-%H:%M:%S)] $(echo $SSH_CLIENT | awk '{ print $1}') - $1" >> /var/log/command.log
}
Dockerfile
FROM node:lts
ARG UID=1001
ARG GID=1001
RUN echo "######### $UID"
RUN echo "######### $GID"
#!/bin/bash | |
function date_to_seconds() { | |
if [[ $# -lt 1 ]]; then | |
echo "Date argument missing" | |
echo "Usage: date_to_seconds date" | |
exit 1 | |
fi |
// Get Real-IP of a user in a separate request header with CloudFront <-> Lambda@Edge | |
'use strict'; | |
exports.handler = (event, context, callback) => { | |
const request = event.Records[0].cf.request; | |
const headers = request.headers; | |
headers['true-client-ip'] = [{ | |
key: 'True-Client-IP', | |
value: request['clientIp'] |
# !/bin/bash | |
# Because GH API was not able to do this. | |
# 1. Copy cURL request from Inspect > Network. | |
# 2. Update the URL like line number 8 (?page='"$i"'&q) | |
# Done! | |
i=0 | |
curl -s 'https://github.com/pulls?page='"$i"'&q=is%3Aopen+is%3Apr+org%3AEXAMPLE+archived%3Afalse+author%3AUSER' \ | |
-H 'Connection: VALUE_123' \ | |
-H 'Pragma: VALUE_123' \ |
#!/bin/bash | |
IP=$(curl -4 icanhazip.com) | |
#echo $IP > /root/ip-changer/currentIPdd | |
OLD_IP=$(cat /root/ip-changer/currentIP) | |
echo "================ $(date) ================" >> /root/ip-changer/checkLog | |
if [ "$IP" != "$OLD_IP" ]; then | |
echo $IP > /root/ip-changer/currentIP |
#!/bin/bash | |
# extract the protocol | |
proto="$(echo $1 | grep :// | sed -e's,^\(.*://\).*,\1,g')" | |
# remove the protocol | |
url="$(echo ${1/$proto/})" | |
# extract the user (if any) | |
user="$(echo $url | grep @ | cut -d@ -f1)" | |
# extract the host and port | |
hostport="$(echo ${url/$user@/} | cut -d/ -f1)" |