Skip to content

Instantly share code, notes, and snippets.

@ChiChou
ChiChou / clearfeed.css
Last active December 29, 2015 03:49
用户CSS。去除人人网、新浪微博、QQ空间的广告和花哨内容。适用于高度洁癖的互联网用户,连“赞”功能也会隐藏,请慎重使用。
/*人人网*/
#fortune,
#notice_system,
.today-topic,
#friends-panel > div:nth-child(1),
#dressupHomeBtn,
.app-title:nth-child(3),
.advert-main,.wide-sponsors,.sponsors,.sales-poll, /*广告系列*/
.web-function,
#rightapp_side_div,
@ChiChou
ChiChou / ujs_library.cpp
Last active December 29, 2015 14:59
破解图书馆上机计费系统
#include <iostream>
#include <Shlwapi.h>
#include <Shlobj.h>
#include <Tlhelp32.h>
#include <Pathcch.h>
#pragma comment(lib, "Shlwapi.lib")
#pragma comment(lib, "Pathcch.lib")
#define SHORT_NAME 32
@ChiChou
ChiChou / Hacker_News_Ranking_Algorithm.sql
Last active July 4, 2016 10:39
Hacker News 排名算法的MYSQL函数实现
-- (p - 1) / (t + 2)^1.5
CREATE FUNCTION SP_POINTS(P SMALLINT(5), CREATED TIMESTAMP)
RETURNS TINYINT(3)
RETURN (P - 1) / POW(TIMESTAMPDIFF(HOUR, CREATED, NOW()) + 2, 1.5);
@ChiChou
ChiChou / gen_ip_list_in_shodan_query_results.js
Created April 18, 2014 08:35
Useful code snippets run in F12 console.
/*
List all ip addresses in query result of Shodanhq.com
*/
(function() {
var a = [], b = document.querySelectorAll('.ip');
for(var i=0; i<b.length; i++) {
a.push(b[i].innerText)
}
console.log(a)
@ChiChou
ChiChou / intranetIp.js
Last active August 29, 2015 14:04
Intranet IP detection for Node.js
(function() {
var os = require('os'), interfaces = os.networkInterfaces(),
ipFilter = function(addr) {
// no need to match 169.254.0.0/16
return !addr.internal &&
(addr.family === 'IPv4' && addr.address.match(/^(192|172|10)\./)) ||
(addr.family === 'IPv6' && addr.address.match(/^f(c0|e8)0:/) || addr.address.match(/^::1{0,1}$/));
};
for (var i in interfaces) {
import numpy as np
from scipy.sparse import csc_matrix
def pageRank(G, s = .85, maxerr = .001):
"""
Computes the pagerank for each of the n states.
Used in webpage ranking and text summarization using unweighted
or weighted transitions respectively.
@ChiChou
ChiChou / update_icon_font.py
Last active August 29, 2015 14:07
Automatic replace iconfont and css content for iconfont.cn project
import zipfile, sys, os, re, urllib2, tempfile
BASE_DIR = 'example/static/'
FONT_DIR = os.path.join(BASE_DIR, 'fonts')
CSS_DIR = os.path.join(BASE_DIR, 'css')
def usage():
print "Invalid param."
print "Usage: %s iconfont.zip" % sys.argv[0]
@ChiChou
ChiChou / nmap_apps.sh
Last active August 29, 2015 14:07
Find out what Applications are supported by nmap.
cat nmap-service-probes|\
grep -o ' p\/[A-Za-z 0-9]*\/'|\
sort|\
uniq -ic|\
sed "s/\/$//"|sed "s/^ p\///"
@ChiChou
ChiChou / cve_2014_3120.sh
Created October 26, 2014 12:52
CVE-2014-3120 Detection
curl -XPOST 'http://localhost:9200/_search?pretty' -d '
{
"size": 1,
"query": {
"filtered": {
"query": {
"match_all": {}
}
}
},
@ChiChou
ChiChou / example.html
Last active October 23, 2017 17:47
HTML5 form attribuition polyfill
<h3>Inside the form:</h3>
<form id="contact_form" method="post">
<label>Name:</label>
<input type="text" id="name" name="name" value="John" />
<br>
<label>Email:</label>
<input type="email" id="email" name="email" value="[email protected]" />
<br>
<input type="submit" id="submit1" value="SEND" />