This file contains hidden or 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/sh | |
echo "hello" |
This file contains hidden or 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/env python | |
# -*- coding: utf-8 -*- | |
import random | |
def RandomCharByString(stInput = None): | |
if stInput == None: | |
yield False | |
liInput = list(stInput) | |
while True: |
This file contains hidden or 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
var fb = Observable.Range(1, 100).Publish(); | |
fb.Where(c1 => c1 % 3 == 0).Subscribe(c1 => Console.WriteLine("Fizz")); | |
fb.Where(c2 => c2 % 5 == 0).Subscribe(c2 => Console.WriteLine("Buzz")); | |
fb.Where(c3 => c3 % 3 != 0 && c3 % 5 != 0).Subscribe(c3 => Console.WriteLine(c3.ToString())); | |
fb.Connect(); | |
var fb2 = new Subject<int>(); | |
fb2.Where(c1 => c1 % 3 == 0).Subscribe(c1 => Console.WriteLine("Fizz")); | |
fb2.Where(c2 => c2 % 5 == 0).Subscribe(c2 => Console.WriteLine("Buzz")); | |
fb2.Where(c3 => c3 % 3 != 0 && c3 % 5 != 0).Subscribe(c3 => Console.WriteLine(c3.ToString())); |
This file contains hidden or 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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Text.RegularExpressions; | |
using System.Diagnostics; | |
namespace CiscoDiff | |
{ |
This file contains hidden or 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
l = [100,200,201,202,203,301,303,305,306,401,402,403,405,501,502,601,602,603,701] | |
#これを | |
# [[701, 603, 602, 601, 502, 501, 405, 403, 402], [401, 306, 305, 303, 301, 203, 202, 201, 200], [100]] | |
#こうしたい | |
from itertools import zip_longest | |
######################################### | |
# zipすると端数分が消されちゃう | |
# [[100, 200, 201, 202, 203, 301, 303, 305, 306], [401, 402, 403, 405, 501, 502, 601, 602, 603]] |
This file contains hidden or 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
l = [100,200,201,202,203,301,303,305,306,401,402,403,405,501,502,601,602,603,701] | |
""" | |
下の4つについてtimeitしたけど、どう考えても、 | |
r,s = s[:9], s[9:] | |
が早いです。本当にありがとうございました。 | |
2.260901534450575 | |
6.795336202391907 | |
1.9528116482399511 | |
9.414626154138594 | |
""" |
This file contains hidden or 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 | |
l = [100,200,201,202,203,301,303,305,306,401,402,403,405,501,502,601,602,603,701] | |
# [[100, 200, 201, 202, 203, 301, 303, 305], [401, 402, 403, 405, 501, 502, 601, 602], [701]] | |
def f(s, l = 9): | |
i = 0 | |
for i in range(len(s) / l): | |
yield s[l * i:l * i + 8] | |
yield s[l * (i + 1): len(s)] | |
print([x for x in f(l)]) |
This file contains hidden or 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
aslookup () { | |
if test `echo $1 | grep "^[0-9]*$" | wc -l ` = "1" | |
then | |
whois -h whois.cymru.com AS$1 | grep -v "AS Name" | cut -d " " -f 1 | |
else | |
whois -h whois.cymru.com $1 | grep -v "AS Name" | |
fi | |
} | |
traceasnum () { | |
tf1=`mktemp /tmp/XXXXXX ` |
This file contains hidden or 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
// need rx.all.js | |
let source = Rx.Observable.range(1, 100); | |
let hot = source.publish(); | |
hot.where(function (c) { | |
return c % 3 === 0; | |
}).subscribe(function (e) { | |
console.log("Fizz") | |
}) |
This file contains hidden or 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
# dictはsetで引き算できないので、一回、tupleにしてからsetで演算してdictに戻すテスト | |
before = [{'netmask': '32', 'ipAddr': '192.168.0.1'}, {'netmask': '32', 'ipAddr': '213.199.128.119'}] | |
after = [{'netmask': '32', 'ipAddr': '192.168.0.1'}, ] | |
print("before: {0}".format(before)) | |
print("after: {0}".format(after)) | |
#before: [{'netmask': '32', 'ipAddr': '192.168.0.1'}, {'netmask': '32', 'ipAddr': '213.199.128.119'}] | |
#after: [{'netmask': '32', 'ipAddr': '192.168.0.1'}] | |
addrList2addrTuple = lambda x: (x["netmask"], x["ipAddr"]) |
OlderNewer