Skip to content

Instantly share code, notes, and snippets.

View guoxiao's full-sized avatar
🐳

Xiao Guo guoxiao

🐳
  • Duolingo
  • Beijing, China
  • 00:19 (UTC +08:00)
  • X @guoxiao
View GitHub Profile
@guoxiao
guoxiao / sudoku.cpp
Created December 6, 2016 14:29
Suduku Solver
#include <array>
#include <assert.h>
#include <functional>
#include <iostream>
#include <set>
#include <stack>
class SudokuSolver {
private:
std::array<int, 81> &sudoku_;
@guoxiao
guoxiao / TrueColour.md
Created August 25, 2016 06:04 — forked from XVilka/TrueColour.md
True Colour (16 million colours) support in various terminal applications and terminals

Colours in terminal

It's a common confusion about terminal colours... Actually we have this:

  • plain ascii
  • ansi escape codes (16 colour codes with bold/italic and background)
  • 256 colour palette (216 colours + 16 ansi + 24 gray) (colors are 24bit)
  • 24bit true colour ("888" colours (aka 16 milion))
printf "\x1b[${bg};2;${red};${green};${blue}m\n"
@guoxiao
guoxiao / README.md
Created October 12, 2013 17:42 — forked from nikcub/README.md
@guoxiao
guoxiao / zhihu.user.js
Last active December 17, 2015 19:08
Zhihu Filter
// ==UserScript==
// @name Zhihu Filter
// @namespace skydiver
// @description I just want to hide some questions.
// @match http://www.zhihu.com/
// ==/UserScript==
var blacklist = ['苹果', '女朋友'];
var len = blacklist.length;
function process(){
var items = document.querySelectorAll('.feed-item .question_link');
@guoxiao
guoxiao / epoll.c
Created November 22, 2012 05:52
epoll
#define MAX_EVENTS 10
struct epoll_event ev, events[MAX_EVENTS];
int listen_sock, conn_sock, nfds, epollfd;
/* Set up listening socket, 'listen_sock' (socket(),
bind(), listen()) */
epollfd = epoll_create(10);
if (epollfd == -1) {
perror("epoll_create");
@guoxiao
guoxiao / facepalm.txt
Created March 17, 2015 08:34
facepalm.txt
..... , . ..:I7?,.. .. ...
. .. ZMMM$+ .. .:OMMM~ ...
,. . OMN:... , 7NN....
.. . :8M, .. . ... .7MO,
. . ?M? .... .. ,...ZM
...~M. ....... ... ........ .7M,. ,.
.:M? .... ..,,:. , .. ........ MN ...
. MM....... .ZMMZONND=,..... ...IM....
. M= ..8DM+.:MM::DN ,..:MD .8O. .
,:M. .=NIMM7 :MM,.MD,.IM+MM..+N. .
@guoxiao
guoxiao / wo.txt
Last active August 29, 2015 14:13 — forked from fei-ke/wo.txt
提速:
http://bj.wokuan.cn/web/improvespeed.php?ContractNo=宽带帐号&up=09&old=07&round=29
恢复: http://bj.wokuan.cn/web/lowerspeed.php?ContractNo=宽带帐号&round=85
上面up old表示提升和本来的两种宽带类型
09是100M
07是10M
round是随机数
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
green='\033[0;32m'
@guoxiao
guoxiao / md5singleblockcollision.py
Created April 11, 2014 14:44
md5 single block collision
import hashlib
import array
a = array.array('I', [
0x6165300e,0x87a79a55,0xf7c60bd0,0x34febd0b,
0x6503cf04,0x854f709e,0xfb0fc034,0x874c9c65,
0x2f94cc40,0x15a12deb,0x5c15f4a3,0x490786bb,
0x6d658673,0xa4341f7d,0x8fd75920,0xefd18d5a
])