Skip to content

Instantly share code, notes, and snippets.

Avatar
🍨

hL plantvsbirds

🍨
View GitHub Profile
@plantvsbirds
plantvsbirds / duipai.py
Created Oct 15, 2019
check mp2... compare garble result. look up table... etc...
View duipai.py
from circuit import BooleanCircuit
from evaluator import GarbledCircuitEvaluator
if __name__ == "__main__":
import sys
import json
if len(sys.argv) < 3:
print("usage: python duipai.py <circuit.json> <garbled.json>")
sys.exit(1)
View gist:f63fcb79db4dee894b9ef8907a6005c8
import {Map, View} from 'ol';
import TileLayer from 'ol/layer/Tile';
import Overlay from 'ol/Overlay.js';
import XYZ from 'ol/source/XYZ';
import { fromLonLat } from 'ol/proj'
window.view = new View({
center: [-13591396.2749238, 4545162.573881949],
zoom: 9
})
@plantvsbirds
plantvsbirds / gist:646b4f067739d62366303013720d3d0b
Created Feb 14, 2019
hey, here's a bolt, and some metal parts, would you like to put them together?
View gist:646b4f067739d62366303013720d3d0b
wrap2 = (c) => {
let isPropFunc = (k) => (typeof c[k] === 'function')
let isProto = (k) => isPropFunc(k) && !!c[k].prototype
let logAccess = (k, v) => {
console.log(`trying to access ${k} at ${c} with ${v}`);
}
console.log(`wrapping ${c}`)
let res = {}
let shouldBind = (v) => !!v && (typeof v == 'object') && (!v.prototype) && (v.__proto__ === HTMLDocument.prototype || v.__proto__ === Window.prototype || v.prototype && v.prototype.isPrototypeOf(document.HTMLElementPrototype))
let cat = (k) => (...args) => {
@plantvsbirds
plantvsbirds / rv_load_obj.sh
Last active Feb 4, 2019
load compiled risc-v object to modelsim-readable memory file
View rv_load_obj.sh
#!/bin/bash
# somebody at ece411 made this and i just changed it, cred cred cred stuff, license license license stuff, yeah.
# Settings
DEFAULT_TARGET=$HOME/ece411/netid/mp1/simulation/modelsim/memory.lst
ASSEMBLER=/class/ece411/software/riscv-tools/bin/riscv32-unknown-elf-gcc
OBJCOPY=/class/ece411/software/riscv-tools/bin/riscv32-unknown-elf-objcopy
OBJDUMP=/class/ece411/software/riscv-tools/bin/riscv32-unknown-elf-objdump
ADDRESSABILITY=1
# Command line parameters
@plantvsbirds
plantvsbirds / feynman-lecture-vol-i.json
Last active Sep 22, 2020
download your copy of epub/mobi of caltech fenman lecture on physics vol i http://www.feynmanlectures.caltech.edu/I_toc.html, powered by https://github.com/lepture/getbook/
View feynman-lecture-vol-i.json
{
"uid": "feynman-lecture-vol-i",
"title": "The Feynman Lectures on Physics, Volume I",
"author": "Richard Feynman",
"chapters": ["http://www.feynmanlectures.caltech.edu/I_89.html","http://www.feynmanlectures.caltech.edu/I_90.html","http://www.feynmanlectures.caltech.edu/I_91.html","http://www.feynmanlectures.caltech.edu/I_92.html","http://www.feynmanlectures.caltech.edu/I_01.html","http://www.feynmanlectures.caltech.edu/I_02.html","http://www.feynmanlectures.caltech.edu/I_03.html","http://www.feynmanlectures.caltech.edu/I_04.html","http://www.feynmanlectures.caltech.edu/I_05.html","http://www.feynmanlectures.caltech.edu/I_06.html","http://www.feynmanlectures.caltech.edu/I_07.html","http://www.feynmanlectures.caltech.edu/I_08.html","http://www.feynmanlectures.caltech.edu/I_09.html","http://www.feynmanlectures.caltech.edu/I_10.html","http://www.feynmanlectures.caltech.edu/I_11.html","http://www.feynmanlectures.caltech.edu/I_12.html","http://www.feynmanlectures.caltech.edu/I_13.html","http://www.feynman
@plantvsbirds
plantvsbirds / million-books-jlb.json
Last active Nov 10, 2018
generate your epub of borges works in zh, powered by lepture/getbook https://github.com/lepture/getbook
View million-books-jlb.json
{
"uid": "book",
"title": "龍騰世紀 博爾赫斯作品集",
"author": "JLB",
"chapters": ["http://millionbook.net/wg/b/boerhesi/000/001.htm", "http://millionbook.net/wg/b/boerhesi/000/002.htm", "http://millionbook.net/wg/b/boerhesi/000/003.htm", "http://millionbook.net/wg/b/boerhesi/000/004.htm", "http://millionbook.net/wg/b/boerhesi/000/005.htm", "http://millionbook.net/wg/b/boerhesi/000/006.htm", "http://millionbook.net/wg/b/boerhesi/000/007.htm", "http://millionbook.net/wg/b/boerhesi/000/008.htm", "http://millionbook.net/wg/b/boerhesi/000/009.htm", "http://millionbook.net/wg/b/boerhesi/000/010.htm", "http://millionbook.net/wg/b/boerhesi/000/011.htm", "http://millionbook.net/wg/b/boerhesi/000/012.htm", "http://millionbook.net/wg/b/boerhesi/000/013.htm", "http://millionbook.net/wg/b/boerhesi/000/014.htm", "http://millionbook.net/wg/b/boerhesi/000/015.htm", "http://millionbook.net/wg/b/boerhesi/000/016.htm", "http://millionbook.net/wg/b/boerhesi/000/017.htm", "http://millionbook.net/wg/b/boerhesi/000/018.htm", "http://
@plantvsbirds
plantvsbirds / yongyongzhihu.js
Last active Apr 29, 2018
不同意「知乎隐私政策概要」并使用
View yongyongzhihu.js
(() => {
let modalNode = document.getElementsByClassName('PrivacyConfirm-modal')[0]
while (modalNode.parentNode !== document.body)
modalNode = modalNode.parentNode
modalNode.remove()
document.body.parentNode.style.overflow = ''
})()
@plantvsbirds
plantvsbirds / test.py
Created Aug 24, 2017
reading protobuf definition from compiled python
View test.py
import Model_pb2 as M
# model_pb2 could be the compiled source
from google.protobuf.descriptor_pb2 import FileDescriptorProto
f = FileDescriptorProto()
f.MergeFromString(M.DESCRIPTOR.serialized_pb)
print f
@plantvsbirds
plantvsbirds / aiofjiosajoifjoias.js
Created Mar 31, 2017
tracking ranking in whale's elevator pitch contest via telegram bot
View aiofjiosajoifjoias.js
import Telebot from 'telebot'
import axios from 'axios'
import cheerio from 'cheerio'
const token = 'IWONTTELL:IWONTTELL',
bot = new Telebot({token, polling : {}})
bot.on('/poll', ({text, from, chat}) => {
@plantvsbirds
plantvsbirds / replay-apis.txt
Created Apr 16, 2016
zhihu follower scrap
View replay-apis.txt
URL https://www.zhihu.com/people/plantvsbird/followers
<input type="hidden" name="_xsrf" value="87aaa16de8fd26f58bf4f9ca38d947f4">
POST https://www.zhihu.com/node/ProfileFollowersListV2
method:next
params:{"offset":20,"order_by":"created","hash_id":"9d62c47e2e6db82938c7bac0909b5e5b"}
_xsrf:87aaa16de8fd26f58bf4f9ca38d947f4
upsert fan profile
You can’t perform that action at this time.