This file contains hidden or 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 socket | |
import sys | |
import time | |
from math import floor | |
class Controller: | |
def __init__(self, sock, target_v): | |
self.s = sock | |
self.target_v = target_v | |
f, v = self.get_status() |
This file contains hidden or 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
netstat -tulpn | grep :80 | |
ls -l /proc/1138/exe |
This file contains hidden or 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
hg pull | |
hg update -r MY_BRANCH -C | |
hg purge |
This file contains hidden or 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
printenv | less |
This file contains hidden or 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
function htmlDecode(input){ | |
var e = document.createElement('div'); | |
e.innerHTML = input; | |
return e.childNodes.length === 0 ? "" : e.childNodes[0].nodeValue; | |
} | |
htmlDecode("<img src='myimage.jpg'>"); | |
// returns "<img src='myimage.jpg'>" |
This file contains hidden or 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
#include <stdio.h> | |
int count = 0; //全局变量 0 | |
void main() | |
{ | |
int count = 10; //局部变量10 | |
printf("count =%d\n",count);//局部变量屏蔽了全局变量 所以输出结果是10 | |
{ | |
int count = 20; | |
printf("count =%d\n",::count); //作用域符号指出引用全局变量0 | |
//::sort |
This file contains hidden or 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
public class MultiThread { | |
public static void main(String[] args) { | |
new Thread(new Thread1()).start(); | |
try { | |
Thread.sleep(10); | |
} catch (InterruptedException e) { | |
e.printStackTrace(); | |
} | |
new Thread(new Thread2()).start(); | |
} |
This file contains hidden or 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
abstract class A{ | |
abstract void f(); | |
A(){ | |
System.out.println("Initialize A before f()"); | |
f(); | |
System.out.println("Initialize A after f()"); | |
} | |
} | |
class B extends A { |
This file contains hidden or 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/bin/python | |
# -*- encoding:utf-8 -*- | |
import cookielib, urllib2, urllib | |
import re | |
def get_postFormID(opener): | |
temp = open('temp.txt', 'w+') | |
form_url = 'http://blog.renren.com/blog/0/addBlog' | |
lines = opener.open(form_url).readlines() | |
# it seems the order of value and id is random |