Skip to content

Instantly share code, notes, and snippets.

View xvdy's full-sized avatar
🌴
On vacation

xvdy

🌴
On vacation
View GitHub Profile
@xvdy
xvdy / parallels-reset.sh
Created July 18, 2022 15:07 — forked from gdurastanti/parallels-reset.sh
Reset Parallels' trial
#!/bin/sh
# Reset Parallels Desktop's trial and generate a casual email address to register a new user
rm /private/var/root/Library/Preferences/com.parallels.desktop.plist /Library/Preferences/Parallels/licenses.xml
jot -w pdu%d@gmail.com -r 1
@xvdy
xvdy / c.snippets
Created December 18, 2018 01:55
c.snippets
## Main
# main
snippet main
int main(int argc, const char *argv[])
{
${0}
return 0;
}
# main(void)
snippet mainn
@xvdy
xvdy / pods
Last active December 17, 2018 07:40
k8s pods
apiVersion: v1 #指定api版本,此值必须在kubectl api-versions中
kind: Pod #指定创建资源的角色/类型
metadata: #资源的元数据/属性
name: web04-pod #资源的名字,在同一个namespace中必须唯一
labels: #设定资源的标签,详情请见http://blog.csdn.net/liyingke112/article/details/77482384
k8s-app: apache
version: v1
kubernetes.io/cluster-service: "true"
annotations: #自定义注解列表
- name: String #自定义注解名字
@xvdy
xvdy / yied based server
Created October 30, 2018 07:56
yied based server
from collections import deque
from select import select
# This class represents a generic yield event in the scheduler
class YieldEvent:
def handle_yield(self, sched, task):
pass
def handle_resume(self, sched, task):
pass
@xvdy
xvdy / opcode
Created July 19, 2018 08:58
python operation code map
```python
def_op('STOP_CODE', 0)
def_op('POP_TOP', 1)
def_op('ROT_TWO', 2)
def_op('ROT_THREE', 3)
def_op('DUP_TOP', 4)
def_op('ROT_FOUR', 5)
def_op('NOP', 9)
def_op('UNARY_POSITIVE', 10)
@xvdy
xvdy / show file
Created July 19, 2018 08:49
pyc file viewer
import dis, marshal, struct, sys, time, types
def show_file(fname):
f = open(fname, "rb")
magic = f.read(4)
moddate = f.read(4)
modtime = time.asctime(time.localtime(struct.unpack('I', moddate)[0]))
print "magic %s" % (magic.encode('hex'))
print "moddate %s (%s)" % (moddate.encode('hex'), modtime)
code = marshal.load(f)
from collections import deque
from select import select
# This class represents a generic yield event in the scheduler
class YieldEvent:
def handle_yield(self, sched, task):
pass
def handle_resume(self, sched, task):
pass
@xvdy
xvdy / bank vault contract
Last active May 5, 2018 11:55
bank vault contract
interface Descriptor {
// serialize value to string;
stringify?(value: any): string;
// deserialize value from string;
parse?(value: string): any;
}
interface DescriptorMap {
[fieldName: string]: Descriptor;
@xvdy
xvdy / rinkeby.io
Created May 4, 2018 02:30
rinkeby.io
0x51B28Bea45646924137d81065f7E7c74F8c65f06
@xvdy
xvdy / logstash-config-file-example
Last active September 2, 2017 08:49
logstash-grok-filter
input{
tcp {
port => 5050
}
# can log from console
#stdin{}
# can get log from file
#file{
# # can be a list like ["a", "b", "*.c"]
# path => "/Users/xudy/workspace/moocnd/logs/elapsed.log"