Skip to content

Instantly share code, notes, and snippets.

@cztchoice
cztchoice / gist:3121770
Created July 16, 2012 09:23
If god is a programmer, what i'll be.
Class Chenzt:Class Person{
Chenzt(){
life();
}
void life(){
while(time)
if(better)
change();
else
continue;
@cztchoice
cztchoice / eight_queens.py
Created August 21, 2012 13:19
eight queens solution from Beginning Python
import random
def conflict(state, nextX):
nextY = len(state)
for i in range(nextY):
if abs(state[i] - nextX) in (0, nextY - i):
return True
return False
@cztchoice
cztchoice / .bashrc
Created November 3, 2012 14:39 — forked from justintv/.bashrc
Display git branch in bash prompt
# If you work with git, you've probably had that nagging sensation of not knowing what branch you are on. Worry no longer!
#export PS1="\\w:\$(git branch 2>/dev/null | grep '^*' | colrm 1 2)\$ "
# This is easy
export PS1="\w\$(__git_ps1 '(%s)') \$ "
# This will change your prompt to display not only your working directory but also your current git branch, if you have one. Pretty nifty!
# ~/code/web:beta_directory$ git checkout master
# Switched to branch "master"
@cztchoice
cztchoice / route_add.sh
Created September 18, 2013 07:39
add Ustc lan ip route table
#!/bin/bash
sudo route add -net 202.38.64.0 gw 114.214.167.254 netmask 255.255.224.0 dev eth0
sudo route add -net 210.45.64.0 gw 114.214.167.254 netmask 255.255.240.0 dev eth0
sudo route add -net 210.45.112.0 gw 114.214.167.254 netmask 255.255.240.0 dev eth0
sudo route add -net 211.86.144.0 gw 114.214.167.254 netmask 255.255.240.0 dev eth0
sudo route add -net 222.195.64.0 gw 114.214.167.254 netmask 255.255.224.0 dev eth0
sudo route add -net 114.214.160.0 gw 114.214.167.254 netmask 255.255.224.0 dev eth0
sudo route add -net 114.214.192.0 gw 114.214.167.254 netmask 255.255.192.0 dev eth0
@cztchoice
cztchoice / 批判性思维.md
Last active December 25, 2015 01:29
批判性思维

批判性思维香港的翻译为 申辩式思维 ,个人感觉这个才是好的翻译啊

是一个工具,这个工具是你对待信息的方式,即在你从某个地方(网上或者书上,还有其他人的语言里)看到一个消息,批判性思维就是用来判断这个消息中附带的观点是否是有错误或者误导性质的,从而决定你应不应该接受该消息中所附带的观点。

一般信息传播是带有一定的目的性的,而这个目的一般就是用来说服人们相信某种观点。

以此为依据信息就可以划分成两部分:

论题_结论,还有怎么得到这个结论的理由

/*
* Hardware event_id to monitor via a performance monitoring event:
*/
struct perf_event_attr {
/*
* Major type: hardware/software/tracepoint/etc.
*/
__u32 type;
@cztchoice
cztchoice / Mintty Default Color.xcs
Last active December 25, 2015 08:59
Mintty Default Color Scheme for XShell Get the color details from: http://mintty.googlecode.com/svn/trunk/docs/mintty.1.html#29 ANSI colours And modify it according real Mintty behavior on Cygwin, such as change blue=6060ff
[Mintty Default Color]
text=bfbfbf
background=000000
magenta=bf00bf
white=bfbfbf
green=00bf00
black=000000
red=ff4040
blue=6060ff
yellow=bfbf00
[perfevents.sample]

# PERF_TYPE_HARDWARE:
# PERF_COUNT_HW_CPU_CYCLES              = 0,
# PERF_COUNT_HW_INSTRUCTIONS            = 1,
# PERF_COUNT_HW_CACHE_REFERENCES        = 2,
# PERF_COUNT_HW_CACHE_MISSES            = 3,
# PERF_COUNT_HW_BRANCH_INSTRUCTIONS     = 4,
# PERF_COUNT_HW_BRANCH_MISSES           = 5,
@cztchoice
cztchoice / test_name_type_error.cpp
Created October 25, 2013 03:27
test name type error, like error: ‘...’ does not name a type
#include<iostream>
#include<vector>
std::vector<int> b;
//This does not name a type
//b.push_back(1);
int c[10];
//This does not name a type too
//c[0] = 1;
void
CacheCntlr::getOwnerStatistics()
{
const unsigned int m_cores = 4;
int used_cache_count = 0;
int owner_count[m_cores] = {0};
int block_total_count = 0;
//printf("%llx\n", reinterpret_cast<unsigned long long>(m_next_cache_cntlr));
//printf("%d\n", Sim()->getConfig()->hasCacheEfficiencyCallbacks());
//use config routine_tracer/type=funcstats enable hasCacheEfficiencyCallbacks function