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
from subprocess import * | |
import sys, re | |
keyword = sys.argv[1] | |
(stdo, stde) = Popen(['ps'], stdout=PIPE).communicate() | |
lines = [j for i,j in enumerate(stdo.decode().split('\n')) if i > 0] | |
r = re.compile(r'\s+') | |
print('keyword', keyword) | |
for line in lines: | |
l = r.split(line.strip()) | |
if len(l) > 1 and l[3].find(keyword) >= 0: |
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
<?xml version="1.0" ?> | |
<project default="main" basedir="/path/to"> | |
<target name="main" depends="begin, A0001, B0001, C0001, end"> | |
</target> | |
<target name="begin"> | |
<echo> | |
Begin execute jobnet. | |
</echo> | |
</target> |
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
def three_times(num): | |
""" | |
>>> three_times(-1) | |
-3 | |
>>> three_times(0) | |
0 | |
>>> three_times(1) | |
3 | |
>>> three_times(3) | |
9 |
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
with open("file.csv", "r") as f: | |
for line in f.readlines(): | |
for col in line.strip().split(","): | |
print(col.split(":")) | |
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
from bottle import view, route, get, post, request, redirect, template, run | |
@route('/') | |
@view('index') | |
def index(): | |
return dict() | |
@route('/hello/<name>') | |
def index(name='World'): | |
return template('Hello {{name}}!', name=name) |
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
"This sets plugins directory. | |
set runtimepath+=~/.vim/vimdoc-ja | |
"This sets default help languages. | |
set helplang=ja,en | |
"This enables you to use syntax highlight. | |
syntax on | |
"This enables you to use pliugins. |
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/awk -f | |
BEGIN { | |
db = "test.db" | |
command = "sqlite3 -noheader -separator \" \" " db " \" %s \"" | |
create_table = "create table employee (id, name, age)" | |
insert1 = "insert into employee values (1, 'taro', 20)" | |
insert2 = "insert into employee values (2, 'hanako', 18)" | |
insert3 = "insert into employee values (3, 'ichiro', 26)" | |
select = "select * from employee order by age" | |
drop_table = "drop table employee" |
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
import sys | |
if __name__ == '__main__': | |
with open(sys.argv[1]) as infile: | |
with open(sys.argv[2], 'w') as outfile: | |
for line in infile.readlines(): | |
outfile.write(line.lstrip()) |
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
import scala.sys.process._ | |
import scala.io.Source._ | |
def in:List[String] = scala.io.Source.stdin.getLines.toList | |
implicit def pathToFileReader(path:String) = new FileReader(path) | |
class FileReader(path:String) { | |
def getLines():List[String] = { | |
try { |
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
sealed abstract class AVLTree[A <% Ordered[A]] { | |
def +(v:A):AVLTree[A] | |
def -(v:A):AVLTree[A] | |
def reconstruct:AVLTree[A] | |
def depth:Int | |
def contains(v:A):Boolean | |
def size:Int | |
def isEmpty:Boolean | |
def nonEmpty:Boolean | |
def toList:List[A] |