This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
exclide_keys = ['Ethernet Channel Bonding Driver', 'Primary Slave', 'Up Delay (ms)', | |
'Down Delay (ms)', 'Slave queue ID', 'Duplex', 'Speed', 'Link Failure Count', | |
'Bonding Mode', 'MII Polling Interval (ms)'] | |
def print_bond_status(dev): | |
md = {} | |
d = {} | |
with open("/proc/net/bonding/{}".format(dev)) as fp: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
usage () | |
{ | |
if [ -e $1 ]; then | |
echo "Usage: $0 {start|stop|status|restart}" | |
exit | |
fi | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import os | |
import time | |
host_name = 'SBC1' | |
bak_dir = '/home/backup/' | |
fn = '{}-{}.tar.xz'.format(host_name, time.strftime("%Y%m%d_%H%M")) | |
def log(s): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import os | |
import time | |
def get_cmd_output(cmd): | |
tmp_fn = "/tmp/mnt_check.tmp" | |
os.system('%s > %s' % (cmd, tmp_fn)) | |
fp = open(tmp_fn, 'r') | |
out = fp.read() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"lastUpload":"2020-08-09T07:23:23.840Z","extensionVersion":"v3.4.3"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Test 2 | |
# [email protected] | |
# | |
# Write a command-line program that prints out the sum of two non-negative integers as input arguments. | |
# Input and output arguments are UTF-8 encoded Korean characters only listed as '일이삼사오육칠팔구' and '십백천만억조'. | |
# The less you use ifs, the higher you get scored. | |
# Google Korean Numbering System if you are not familiar with. | |
# | |
# Expected result: | |
# $ python3.6 test2.py 오백삼십조칠천팔백구십만천오백삼십구 삼조사천이만삼천구 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Test 1 | |
# [email protected] | |
# | |
# Write a command-line program that prints out the sum of two non-negative integers as input arguments. | |
# You must not use any built-in BigInteger library or convert the inputs to integer directly. | |
# | |
# Expected result: | |
# $ python3.6 test1.py 123123111242342342003004400442255523 225244004004004234234234412312399999 | |
# 123123111242342342003004400442255523 + 225244004004004234234234412312399999 = 348367115246346576237238812754655522 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import time | |
start_timestamp = 1550587841 | |
for serial in os.listdir('.'): | |
for fn in os.listdir(serial): | |
ctime = os.stat(os.path.join(serial, fn)).st_ctime | |
if ctime > start_timestamp: | |
date_in_filename = fn.split('_')[0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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] |
NewerOlder