Skip to content

Instantly share code, notes, and snippets.

Avatar

kacchan822 kacchan822

View GitHub Profile
@kacchan822
kacchan822 / check_cert_chrome.py
Last active Feb 1, 2018
checker for Chrome distrusting Symantec certificates.
View check_cert_chrome.py
#!/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
View memchach_test.pl
#!/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
CSV Response Mixin for Django -- python3.5 , Django 1.11
View CsvResponseMixin.py
import csv
import email.utils
from django.http import HttpResponse
class CsvResponseMixin(object):
filename = 'csvfile.csv'
content_type = 'text/csv; charset=UTF-8'
View 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 Jan 20, 2017
Fail2ban filter for SoftEther VPN server
View sfvpn-ddos.conf
# 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 =
View rbenv_install.sh
#!/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!"
@kacchan822
kacchan822 / gen_crypt_password.py
Created Sep 12, 2016
Genarate MD5-CRYPT password string from PLAIN password string for python 2.x or higher.
View gen_crypt_password.py
def gen_crypt_password(password):
from crypt import crypt
import random
""" MD5-CRYPTパスワード文字列を生成 for python2.x
"salt"は[a-zA-Z0-9./]から選ばえれることになっているので、
chr()でアルファベット大文字(65~91)、小文字(97~123)のシーケンスを生成して、
  .と/を付け加えて、"salt"の元とする
View rubi.py
""" generate kana """
def rubi(letters):
"""Generate kana.
alphabet upper case letter --> 'カタカナ'(大文字)
alphabet lowe case letter --> 'カタカナ'
none alphabet letter --> not convert to kana.
each kana is joined by '・'.
@kacchan822
kacchan822 / swhois.py
Last active Mar 3, 2016
simple_whois.py
View swhois.py
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
#
import sys
import ipaddress
from ipwhois import IPWhois
def swhois(ip):
obj = IPWhois(ip)
@kacchan822
kacchan822 / softethervpn_letsencrypt_cert_autoupdate.sh
Last active Sep 17, 2019
softethervpn_letsencrypt_cert_autoupdate.sh
View 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
#
You can’t perform that action at this time.