Skip to content

Instantly share code, notes, and snippets.

import math
import pygame
# define game setting
NUM_BRICKS = (10, 10)
SCREEN_SIZE = (600, 400)
PAD_SIZE = (120, 10)
BALL_R = 10
BRICK_W = SCREEN_SIZE[0] / NUM_BRICKS[0]
BRICK_H = SCREEN_SIZE[1] / NUM_BRICKS[1] / 2
@wuyongzheng
wuyongzheng / gist:f0dc86f297ea5875697630d260f80773
Created December 21, 2023 16:28
Install and run Ubuntu arm64 in x84 qemu environment
# Install and run Ubuntu arm64 in x84 qemu environment
### Download Ubuntu iso image
### Compile qemu
### Install
### Run
### Credits
* seryta mao's answer in superuser. https://superuser.com/a/1782085
* User networking. https://wiki.qemu.org/Documentation/Networking
@wuyongzheng
wuyongzheng / morph.py
Created November 8, 2023 15:01
Transform (morph) image according to control points from Hugin
import sys
import numpy as np
from sklearn import linear_model
import imageio
# control point file format:
# x1 tab y1 tab x2 tab y2
# x1 tab y1 tab x2 tab y2
# ...
def read_cp(cp_path):
We can make this file beautiful and searchable if this error is corrected: It looks like row 4 should actually have 71 columns, instead of 45. in line 3.
-,aaai,acl,asplos,cav,ccs,chi,crypto,cvpr,dac,eccv,emnlp,emsoft,eurocrypt,eurosys,fast,focs,hpca,hpdc,huc,iccad,iccv,icde,icfp,icml,icra,ics,icse,ijcai,imc,iros,isca,issta,kbse,kdd,lics,micro,mobicom,mobisys,naacl,ndss,nips,nsdi,oopsla,osdi,pervasive,pldi,pods,popl,recomb,rss,rtas,rtss,sc,sensys,sigcomm,sigecom,sigir,sigmetrics,sigmod,sigsoft,soda,sosp,sp,stoc,uist,usenix,uss,vr,wine,www
aaai,0,901,50,137,98,208,11,948,136,696,938,38,15,38,42,105,53,56,169,133,638,414,20,829,401,58,109,1800,34,392,53,52,138,823,111,51,118,74,534,57,1038,47,35,34,34,51,132,48,121,171,39,68,81,124,77,358,664,81,270,106,172,21,41,107,68,70,47,116,288,577
acl,901,0,25,15,45,143,3,253,49,164,2655,4,1,17,23,16,21,19,65,29,146,180,3,374,102,17,58,635,17,96,23,30,78,375,19,19,41,34,1784,25,437,26,19,20,7,24,37,13,45,35,9,20,26,55,22,24,615,28,156,55,19,14,20,8,56,43,29,41,22,407
asplos,50,25,0,105,170,38,12,44,405,33,24,63,17,458,280,7,792,206,40,239,25,73,101,52,30,427,148,40,53,31,1029,117,114,44,17,1015,69,142,19,126,68,189,374,40
strict graph {
node [fontsize=16]
AAAI -- IJCAI
AAAI -- NIPS
AAAI -- CVPR
AAAI -- EMNLP
AAAI -- ACL
ACL -- EMNLP
ACL -- NAACL
ACL -- AAAI
@wuyongzheng
wuyongzheng / segsat.py
Created December 19, 2020 12:55
7 segment decoder with minimal nor gates
from z3 import *
def build_gate(nodes, edges):
assert len(nodes) == len(edges)
subs = [And(node, edge) for node, edge in zip(nodes, edges)]
return Not(Or(subs))
def build_circuit(inputs, edgemap, sels):
nodes = list(inputs)
for edges in edgemap:
LANGUAGE=en_SG:en
HOME=/home/yz
LOGNAME=yz
PATH=/usr/bin:/bin
LANG=en_SG.UTF-8
SHELL=/bin/sh
PWD=/home/yz
LANGUAGE=en_SG:en
HOME=/home/yz
LOGNAME=yz
# Usage: python3 p5-bayes.py z4-mark z4-noma
import sys
import numpy as np
import scipy.stats
def load_data(path):
nr_fields = None
ids = list()
vecs = list()
C:\Users\v>cd Desktop\aimage\walleye-opm1.171019.011
C:\Users\v\Desktop\aimage\walleye-opm1.171019.011>flash-all.bat
target reported max download size of 536870912 bytes
sending 'bootloader_a' (38644 KB)...
OKAY [ 0.833s]
writing 'bootloader_a'...
(bootloader) Updating: partition:0 @00002000 sz=0000B000
FAILED (remote: Command Flash Error)
finished. total time: 0.841s
@wuyongzheng
wuyongzheng / crawl.sh
Created November 12, 2017 14:04
Tweeter user timeline crawler without authentication
#!/bin/bash
# change this
user=SMRT_Singapore
while true ; do
if [ -f crawl-0.json ] ; then
pos=`cat crawl-*.json | tr ',' '\n' | grep 'min_position.:.[0-9]' | sed -e 's/.*:"//' -e 's/".*//' | sort -n | head -n 1`
url="https://twitter.com/i/profiles/show/$user/timeline/tweets?include_available_features=1&include_entities=1&max_position=$pos&reset_error_state=false"
else