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, "w", encoding="utf-8") as f: | |
json.dump(js_obj, f, indent=4, separators=(',', ': ')) |
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 parse_header(raw_header: str): | |
header = dict() | |
for line in raw_header.split("\n"): | |
if line.startswith(":"): | |
a, b = line[1:].split(":", 1) | |
a = f":{a}" | |
else: | |
a, b = line.split(":",1) |
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
pandoc -o OUTFILE.pdf --pdf-engine=xelatex -V mainfont="Microsoft YaHei" INFILE.md |
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.reflect._ | |
class Foo{ | |
def expect[T: ClassTag](that: Any) = { | |
if (classTag[T].runtimeClass.isInstance(that)) { | |
doSomething | |
} | |
} | |
} |
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 requests | |
from urllib.parse import quote | |
content = quote(r''' | |
\documentclass{article} | |
\title{Title} | |
\author{Author} | |
\date{\today} |
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
git branch | grep -v master | xargs git branch -d |
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 reverse = (arr)=>{ // Array.prototype.reverse is overridden in a bloody way in the webpage | |
const res = [] | |
for (let index = arr.length-1; index >= 0; index--) { | |
const element = arr[index]; | |
res.push(element) | |
} | |
return res | |
} | |
(() => { |
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
fn = () => { | |
l = "0123456789qwertyuiopasdfghjklzxcvbnm" | |
candidates = [] | |
for (const c1 of l) { | |
for(const c2 of l){ | |
candidates.push(c1 + c2) | |
} | |
} | |
for (const suffix of candidates){ |