Skip to content

Instantly share code, notes, and snippets.

View beordle's full-sized avatar
💌
On vacation, oh..

Jindong Zhang beordle

💌
On vacation, oh..
  • Tencent
  • Beijing, China
View GitHub Profile
@beordle
beordle / 0_reuse_code.js
Created June 13, 2014 20:39
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@beordle
beordle / flatten.py
Last active August 29, 2015 14:12 — forked from andelf/flatten.py
flatten = lambda lst: reduce(lambda l,i: l + flatten(i) if isinstance(i, (list,tuple)) else l + [i], lst, [])
print flatten([2, [2, [4, 5, [7], [2, [6, 2, 6, [6], 4]], 6]]])
# -> [2, 2, 4, 5, 7, 2, 6, 2, 6, 6, 4, 6]
@beordle
beordle / dota卡尔改建.py
Last active December 13, 2015 22:19
以前写的dota卡尔改建
#coding:utf-8
"""卡尔,25级时神一样的英雄。因为DotA里最为拉风的英雄是卡尔,也就前期较为弱势。虽然没有后期DPS,但是并不是说他输出不行,只是站不住而已。不过它主要还是个大后期法师。
具体的改建方案是
'F':('EEQ','熔炉精灵'),
'G':('QQE','寒冰之墙'),
'V':('QQW','幽灵漫步'),
这三个技能需要连按技能键一次或两次(如果技能已经存于面板中,只需一次),而
'Y':('QQQ','急速冷却'),
'B':('QWE','超震声波'),
@beordle
beordle / 圣堂改建.py
Created February 19, 2013 07:21
圣堂改建 一键大招(削弱前有用)
#coding:utf-8
import ctypes,win32ui,win32con,pyHook,pythoncom,time,win32api
WAR3_WINDOW_CLASS=None
WAR3_WINDOW_NAME="Warcraft III"
def click():
x,y=win32api.GetCursorPos()
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x,y,0,0)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,x,y,0,0)
@beordle
beordle / 批量改名.py
Created February 19, 2013 07:28
给同学开网店写的文件批量改名程序 python+Tkinter
#coding:utf-8
from Tkinter import *
import tkSimpleDialog,tkFileDialog,os
from ttk import *
def ask():
a = tkSimpleDialog.askstring('Beordle','Text from:',initialvalue='')
if a==None:
return None,None
b = tkSimpleDialog.askstring('Beordle','Text to:',initialvalue='')
sudo rpi-update
sudo apt-get install python-dev
sudo easy_install -U distribute
sudo apt-get update
sudo apt-get install python-setuptools
sudo apt-get install rpi.gpio
sudo apt-get install python-pip
sudo pip install rpi.gpio
sudo easy_install pip
@beordle
beordle / 网络时间.py
Created February 19, 2013 07:56
从 网络time.windows.com time.apple.com 校正时间
from socket import *
import datetime,os,struct,time,sys
# Script to set Linux hardware clock (/usr/sbin/hwclock) from an NTP
# time server. Run as "setclock.py" to simply print the time from
# the NTP server. Run as "setclock.py --set" to set the Linux
# hardware clock (as the super user, of course).
# Based on Simon Foster's simple SNTP client from ASPN Python cookbook.
# Adapted by Paul Rubin; this script lives at:
# http://www.nightsong.com/phr/python/setclock.py
@beordle
beordle / 网络校时.py
Created February 20, 2013 12:12
时间 网络
# -*- coding: utf-8 -*-
import socket,sys,time
#时间服务器
host = "stdtime.gov.hk"
#端口
port = 37
#时区
curtz = 8
#连接服务器,并接收返回
try:
@beordle
beordle / trace.c
Created December 2, 2021 07:36 — forked from MKo-xx/trace.c
trace.c
#include <stdio.h> // printf
#include <string.h> // strerror
#include <errno.h> // errno
#include <unistd.h> // execl
#include <sys/ptrace.h> // ptrace
#include <sys/user.h> // user_regs_struct
// get from strace sources
// cat strace-4.6/linux/x86_64/syscallent.h | sed -e 's/\(".*"\)/=\1/' | sed -e 's/^.*=//' | sed -e 's/"\(.*\)".*$/"\1",/'
//
@beordle
beordle / sys_sum.go
Created January 11, 2022 03:12 — forked from ianlewis/sys_sum.go
Simple syscall in gVisor
// Copyright 2018 The gVisor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,