Skip to content

Instantly share code, notes, and snippets.

View noname007's full-sized avatar
📖
Focusing

soul11201 noname007

📖
Focusing
View GitHub Profile
@noname007
noname007 / grawb.js
Last active September 21, 2016 10:03
js 抓取页面 a标签,文本长度大于6
var as = document.getElementsByTagName('a');
var i = 0,j = as.length;
for(i=0;i<j;++i){
if(as[i].innerText !="" && as[i].innerText.length > 5)
console.log(i,as[i].href,as[i].innerText)
}
0 = Success
1 = Operation not permitted
2 = No such file or directory
3 = No such process
4 = Interrupted system call
5 = Input/output error
6 = No such device or address
7 = Argument list too long
8 = Exec format error
stop:
sudo /usr/local/nginx/sbin/nginx -s stop
start:
sudo /usr/local/nginx/sbin/nginx
restart: stop start
log:
xterm -e 'tail -f /usr/local/nginx/logs/*' &
@noname007
noname007 / ks.signature.php
Last active December 31, 2015 04:06
金山 直播 签名生成
<?php
$_param['accesskey'] = KS_AK;
$_param['expire'] = time()+3*3600;
$_param['method'] = 'add';
$_param['app'] = 'appappapp';
$_param['name'] = 'test';
$_param['nonce'] = uniqid();
$_param['public'] = 1;
$_param['vdoid'] = 1;
#user nobody;
worker_processes 4;
#error_log logs/error.log;
#error_log logs/error.log notice;
error_log logs/error.log info;
#pid logs/nginx.pid;
@noname007
noname007 / nginx.conf
Created October 30, 2015 11:52
NGINX-RTMP push to Twitch and Hitbox
#user nobody;
worker_processes 1;
error_log logs/rtmp_error.log debug;
pid logs/nginx.pid;
events {
worker_connections 1024;
}
@noname007
noname007 / active.md
Created October 20, 2015 03:13 — forked from paulmillr/active.md
Most active GitHub users (by contributions). http://twitter.com/paulmillr

Most active GitHub users (git.io/top)

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Sat, 04 Oct 2014 19:10:54 GMT till Sun, 04 Oct 2015 19:10:54 GMT.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

githubUsers
 .filter((user) -&gt; user.followers &gt; 474)
p = print
local mt ={}
local _t = {}
local mt_t = {}
mt.__newindex = _t
mt_t.__newindex = function(t,k,v)
@noname007
noname007 / read_cmd_input.php
Last active August 29, 2015 14:19
程序运行时从命令行读取数据. read data from cmd while running.
<?php
function read_cmd_input($rule_read_cmd = array())
{
if(empty($rule_read_cmd))
$rule_read_cmd = array('yes'=>1,'no'=>0);/*结束读取的操作,及对应的返回值*/
$cmd = '';
$fh = fopen('php://stdin','r');
$rule_read_cmd_key = array_keys($rule_read_cmd);
$rule_read_cmd_str = join(',',$rule_read_cmd_key);
echo 'Please input [',$rule_read_cmd_str,']:';
@noname007
noname007 / render.php
Created March 25, 2015 08:37
sql-table->html-table
<?
function render($rows)
{
$str = '<table border="1">';
foreach ($rows as $row) {
$str .='<tr>';
foreach ($row as $key => $value) {
$str .= '<td bgcolor="silver">'.$key.'</td><td>'.$value.'</td>';
}
$str .= '</tr>';