Skip to content

Instantly share code, notes, and snippets.

View kacchan822's full-sized avatar

kacchan822 kacchan822

View GitHub Profile
@kacchan822
kacchan822 / softethervpn_letsencrypt_cert_autoupdate.sh
Last active March 26, 2021 17:22
softethervpn_letsencrypt_cert_autoupdate.sh
#!/bin/bash
#
# Copyright (c) 2016 Katsuya SAITO
# This software is released under the MIT License.
# http://opensource.org/licenses/mit-license.php
#
# @(#) softethervpn_letsencrypt_cert_autoupdate.sh ver.0.1.0 2016.02.20
#
# Usage: softethervpn_letsencrypt_cert_autoupdate.sh CommonName WEBROOT PASSWORD MAIL
#
@kacchan822
kacchan822 / vpnserver.service
Created February 20, 2016 02:28
SoftEtherVPN_systemd
[Unit]
Description=SoftEther VPN Server
After=network.target network-online.target
[Service]
Type=simple
ExecStart=/usr/local/vpnserver/vpnserver execsvc
ExecReload=/bin/kill -HUP $MAINPID
KillMode=control-group
Restart=on-failure
@kacchan822
kacchan822 / vpnclient
Created January 25, 2016 14:25
SoftEther VPN Client for Ubuntu /etc/init.d/vpnclient
#!/bin/bash
### BEGIN INIT INFO
# Provides: vpnclient
# Required-Start: $all
# Required-Stop: $network $local_fs $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: SoftEther VPN Client
# chkconfig: 2345 99 1
# description: SoftEther VPN Client
@kacchan822
kacchan822 / check_cert_chrome.py
Last active February 1, 2018 14:11
checker for Chrome distrusting Symantec certificates.
#!/usr/bin/env python3
# This software is released under the MIT License.
# http://opensource.org/licenses/mit-license.php
import datetime
import re
import socket
import ssl
import sys
@kacchan822
kacchan822 / check_geoip.py
Last active October 25, 2017 02:53
check_geoip.py
#!/usr/bin/env python3
#
# install required packeges:
# sudo apt-get install python3-geoip geoip-database libgeoip1
#
# download script:
# sudo curl -sS -o /usr/local/bin/check_geoip.py https://gist.githubusercontent.com/kacchan822/f9240646cfd78a5290a2ec95d844b1a0/raw/check_geoip.py
# sudo chmod +x /usr/local/bin/check_geoip.py
#
# setting up hosts.allow and hosts.deny:
@kacchan822
kacchan822 / sfvpn-ddos.conf
Created January 20, 2017 04:57
Fail2ban filter for SoftEther VPN server
# Fail2Ban sfvpn-ddos filter
#
[INCLUDES]
before = common.conf
[Definition]
failregex = A DoS attack on the TCP Listener \(port \d+\) has been detected\. The connecting source IP address is <HOST>, port number is \d+\. This connection will be forcefully disconnected now\.
ignoreregex =
#!/usr/bin/perl
use strict;
use Cache::Memcached;
my $memcached = Cache::Memcached->new({
servers => ["127.0.0.1:11211"]
});
print "Set (key, hoge) exptime:12sec\n";
$memcached->add('key', 'hoge', 12);
@kacchan822
kacchan822 / CsvResponseMixin.py
Created May 22, 2017 12:16
CSV Response Mixin for Django -- python3.5 , Django 1.11
import csv
import email.utils
from django.http import HttpResponse
class CsvResponseMixin(object):
filename = 'csvfile.csv'
content_type = 'text/csv; charset=UTF-8'
@kacchan822
kacchan822 / rDNSlookup.sh
Last active October 28, 2016 12:24
rDNSlookup
#!/bin/bash
#
# Copyright (c) 2016 Katsuya SAITO
# This software is released under the MIT License.
# http://opensource.org/licenses/mit-license.php
#
# @(#) rDNSlookup.sh ver.1.0.2 2016.01.29
#
# Usage:
# rDNSlookup.sh file
#!/bin/bash
#
# instal rbenv and then, install ruby 2.3.0 and gem update, install bundler.
# This script is written for CentOS 7.
#
set -e
if [ ! -e /etc/redhat-release ]; then
echo "This script can only run on CentOS!"