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
# Windows | |
C:\Windows\System32\drivers\etc |
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 dask.bag as db | |
labels = ["abc", "abd", "bcd"] | |
b = db.from_sequence(labels) | |
def join_2_set(a, b): | |
return set(a) | set(b) | |
char_sets = b.map(set).fold(join_2_set).compute() |
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
# ref: https://www.geeksforgeeks.org/lru-cache-in-python-using-ordereddict/ | |
from collections import OrderedDict | |
class LRUCache: | |
def __init__(self, capacity): | |
self.cache = OrderedDict() | |
self.capacity = capacity | |
def get(self, k): |
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
package main | |
import ( | |
"bufio" | |
"fmt" | |
"io" | |
"os" | |
"strconv" | |
"strings" | |
) |
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
package main | |
import ( | |
"encoding/xml" | |
"fmt" | |
"io/ioutil" | |
"os" | |
) | |
type Annotation struct { |
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
// spawn 10 concurrent workers to download links | |
package main | |
import ( | |
"bufio" | |
"fmt" | |
"io" | |
"net/http" | |
"os" | |
) |
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
-- Prepare {src,tgt}-train.txt for OpenNMT Image2Text | |
-- labels (json) >> prepareDataOpenNMT.hs >> src+tgt+vocab.txt (io) | |
-- src: tgt | |
-- 123.jpg <tr><td></td> | |
-- 456.jpg <tr colspan=2 ><td></td> | |
-- | |
-- vocab: | |
-- <td | |
-- colspan="2" | |
-- > |
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
# refer: https://stackoverflow.com/questions/18172257/efficient-calculation-of-fibonacci-series/23462371#23462371 | |
import functools | |
@functools.lru_cache(None) | |
def fib(n): | |
if n < 2: | |
return n | |
return fib(n-1) + fib(n-2) |
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
# tunnel 3888->8888 from the 'fti' server | |
ssh -L 3888:fti:8888 fti -N |
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 ruby | |
require 'net/http' | |
require 'json' | |
q = ARGV[0] | |
def get (url) | |
uri = URI(url) | |
return Net::HTTP.get(uri) | |
end |
NewerOlder