Skip to content

Instantly share code, notes, and snippets.

Avatar

Guo Xiao guoxiao

View GitHub Profile
View sudoku.cpp
#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 Aug 25, 2016 — forked from XVilka/TrueColour.md
True Colour (16 million colours) support in various terminal applications and terminals
View TrueColour.md

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"
View 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 Aug 29, 2015 — forked from fei-ke/wo.txt
View 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是随机数
View osx-for-hackers.sh
#!/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 Apr 11, 2014
md5 single block collision
View md5singleblockcollision.py
import hashlib
import array
a = array.array('I', [
0x6165300e,0x87a79a55,0xf7c60bd0,0x34febd0b,
0x6503cf04,0x854f709e,0xfb0fc034,0x874c9c65,
0x2f94cc40,0x15a12deb,0x5c15f4a3,0x490786bb,
0x6d658673,0xa4341f7d,0x8fd75920,0xefd18d5a
])
View README.md
@guoxiao
guoxiao / zhihu.user.js
Last active Dec 17, 2015
Zhihu Filter
View zhihu.user.js
// ==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');
View epoll.c
#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");
You can’t perform that action at this time.