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 React from "react" | |
import kebabCase from "lodash/kebabCase" | |
class HeaderNode { | |
constructor(value, depth) { | |
this.value = value | |
this.depth = depth | |
this.children = [] | |
} |
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
# rename local master branch to "main" | |
git branch -m master main | |
# push to remote branch as "main" | |
git push origin main:main | |
# go to github, change the default branch, which usually to be "master" | |
# delete remote "master" branch | |
git push origin --delete master |
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
require 'net/http' | |
zhihu = 'https://zhuanlan.zhihu.com/p/139146103' | |
uri = URI(zhihu) | |
# user agent is necessary otherwise Zhihu throws 400 | |
user_agent = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36' | |
res = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|. # :use_ssl => true for the uri is https | |
http.request(Net::HTTP::Get.new(uri, {'User-Agent' => user_agent})) |
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/local/bin/python3 | |
import re | |
import glob | |
import os | |
TAG_TEMPLATE = '''--- | |
layout: tag_pages | |
title: "{tag}" | |
tag: {tag} |
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
args=$# # Number of args passed. | |
lastarg=${!args} | |
# or: | |
# lastarg=${!#} | |
echo $lastarg |
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
var page = require('webpage').create(); | |
page.onConsoleMessage = function(msg) { | |
console.log(msg); | |
}; | |
var ieeeSignInUrl = "https://regauth.standards.ieee.org/standards-ra-web/rest/signin"; | |
page.open(ieeeSignInUrl, function(status) { | |
if ( status === "success" ) { |