Skip to content

Instantly share code, notes, and snippets.

View ziozzang's full-sized avatar

Jioh L. Jung ziozzang

View GitHub Profile
@ziozzang
ziozzang / smtp_test.sh
Last active January 29, 2019 06:38
Simple SMTP test with shell script(bash)
#!/bin/bash
EMAIL_BODY="Test from telnet - $(LANG=c date)"
EMAIL_SUBJECT="Telnet test - $(LANG=c date)"
SMTP_SERVER="smtp.some.server"
SMTP_PORT="25"
MAIL_TO="asdf@foo.com"
MAIL_FROM="asdf@bar.com"
echo ">> ${my_email_subject}"
@ziozzang
ziozzang / README.md
Last active January 28, 2019 23:42
DNS server with whitelist/blacklist.

TL;DR

  • DNSP is very simple and useful tool to setup whitelisted or blacklisted dns proxy server.
  • if you want to use with dockered image, this script will be a good starting point.

Author

Basic

  • if you use android tethering, masquerade makes client device's TTL decrease.

    • so Telco can detect what packet is used with tethering.
  • this means that if your kernel doesn't decrease TTL with hop, telco can't detect tethering packet by TTL value.

    • but, there's another way to detect. however, I think that TTL is enough to use. maybe, maybe...

Logic

  • bascially tethering use 'masquerade' and it use 'ip_forward'. and it is linux's net function.
  • and, it count one hop. so ip_forward must obey ip specification. this means that decrease ttl with passing hop.
SESSION_PAGE="https://streamza.com/api/sessions/_login"
COOKIE_FILE="wget-cookies.txt"
USERNAME="USERNAME"
PASSWORD="PASSWORD"
FILE_URL="FILE_TO_DOWNLOAD"
if [[ ! -f $COOKIE_FILE ]]; then
@ziozzang
ziozzang / get-letsencrypt-wildcard-cert.sh
Last active May 8, 2018 02:16
This docs show how to issuing wildcard cert(by Let's Encrypt) with docker and DNS challenge. no need to install any software.
EMAIL="foo@barcom"
DOMAINS="example.com"
###################################################################
# Renewing
docker run \
-it --rm \
-v /opt/letsencrypt/:/etc/letsencrypt/ \
-v /opt/letsencrypt/logs/:/var/log/letsencrypt/ \
@ziozzang
ziozzang / get-letsencrypt-wildcard-cert.sh
Created May 5, 2018 06:29
This docs show how to issuing wildcard cert(by Let's Encrypt) with docker.
EMAIL="foo@barcom"
DOMAINS="example.com"
###################################################################
# Renewing
docker run \
-it --rm \
-v /opt/letsencrypt/:/etc/letsencrypt/ \
-v /opt/letsencrypt/logs/:/var/log/letsencrypt/ \
#Block Kernel Update. /boot partition size is too small... :(
apt-mark hold `uname -r` linux-image-generic linux-headers-generic
# Partition Resize
pvscan && vgextend localhost-vg /dev/sda3 && lvextend -l +100%FREE /dev/localhost-vg/root && resize2fs /dev/localhost-vg/root
# Set Disk Timeout.
#echo 300 > /sys/block/sda/device/timeout
sed -i 's,^exit,#exit,' /etc/rc.local
echo "swapoff -a" >> /etc/rc.local
@ziozzang
ziozzang / docker-compose.yml
Created March 15, 2018 23:12
Source Graph with Docker-compose
version: '2'
services:
sourcegraph:
image: sourcegraph/server
restart: always
volumes:
- ./config:/etc/sourcegraph
- ./data:/var/opt/sourcegraph
ports:
curl -fsSL get.docker.com -o get-docker.sh && sh get-docker.sh && \
curl -L https://github.com/docker/compose/releases/download/1.18.0/docker-compose-`uname -s`-`uname -m` \
-o /usr/bin/docker-compose \
&& chmod +x /usr/bin/docker-compose
@ziozzang
ziozzang / esxi_trial_reset.sh
Created January 22, 2018 01:20
Automated ESXi Trial Reset
echo "0 2 * * * rm -r /etc/vmware/license.cfg && cp /etc/vmware/.#license.cfg /etc/vmware/license.cfg && /etc/init.d/vpxa restart" >> /var/spool/cron/crontabs/root