Skip to content

Instantly share code, notes, and snippets.

View YUChoe's full-sized avatar

Yong-uk Choe YUChoe

View GitHub Profile
@YUChoe
YUChoe / flask_gunicorn_app.py
Last active June 25, 2018 02:24 — forked from KatiRG/flask_gunicorn_app.py
Running Flask with Gunicorn
# coding: utf-8
# This gist shows how to integrate Flask into a
# custom Gunicorn-WSGI application described
# here: http://docs.gunicorn.org/en/stable/custom.html
from __future__ import unicode_literals
import multiprocessing
import gunicorn.app.base
from gunicorn.six import iteritems
@YUChoe
YUChoe / chkroute.pl
Last active November 14, 2016 02:26
static routing
#!/usr/bin/perl
foreach my $l (split(/\n/, `route -n`)) {
my @ll = split(' ', $l);
$r{$ll[0]} = [$ll[0], $ll[2], $ll[1]];
}
foreach my $l (split(/\n/, `cat /usr/local/shieldone/etc/route/addroute`)) {
@ll = split(' ', $l);
if ( $ll[0] eq $r{$ll[0]}[0]
@YUChoe
YUChoe / vpnwatch
Created February 1, 2015 10:58
SSLVPN openvpn daemon watch
#!/bin/bash
installDir="{{MASK}}"
LOG="{{MASK}}"
RUN="/usr/sbin/openvpn --config $installDir/etc/openvpn/server.conf --cd $installDir/etc/openvpn"
echo "`date` starting... watching sslvpn daemon" >> $LOG
while true;
@YUChoe
YUChoe / mkccd.py
Created January 30, 2015 02:58
fron list.txt to ccd
#!/usr/bin/python
def ipaddone(i) :
l = i.split(".")
brd30 = [3,7,11,15,19,23,27,31,35,39,43,47,51,55,59,63,67,71,75,79,83,87,91,95,99,103,107,111,115,119,123,127,131,135,139,143,147,151,155,159,163,167,171,175,179,183,187,191,195,199,203,207,211,215,219,223,227,231,235,239,243,247,251,255]
if int(l[3])+1 in brd30 :
return "%s.%s.%s.%d" % (l[0],l[1],l[2],int(l[3])-1)
return "%s.%s.%s.%d" % (l[0],l[1],l[2],int(l[3])+1)
fp = open ("list.txt")
@YUChoe
YUChoe / spm_get
Created January 15, 2015 08:48
/usr/bin/spm_get
#!/bin/bash
wget -qO- $1 | sudo tar xvz
@YUChoe
YUChoe / make_nagios_node.py
Last active August 29, 2015 14:09
simple nagios3 node maker for www.plus-i.co.kr
#!/usr/bin/env python
import sys
import os
fpath = '/home/plus-i/nagios3-conf.d/'
def print_usage() :
print "Usage: %s add {hostname} {ip address|domain name}" % (sys.argv[0])
print " %s del {hostname}" % (sys.argv[0])
@YUChoe
YUChoe / sid_rev.py
Last active August 29, 2015 14:08 — forked from idhunter/sid_rev.py
for line in open('a.txt'):
# print line
a_id = line.find("sid:")
a_rev = line.find("rev:")
# print a_id
# print a_rev
print line[a_id+4:a_rev-2]
print line[a_rev+4:-3]
for line in open('b.txt'):
@YUChoe
YUChoe / pinglog
Last active August 29, 2015 14:08
ping with perl
#!/usr/bin/perl
use Net::Ping;
use POSIX;
if ($#ARGV == -1) { die "Usage: pinglog {ip address} \n"; }
$host = $ARGV[0];
$ping = Net::Ping->new("icmp", 2);
$status = "Dead";