Skip to content

Instantly share code, notes, and snippets.

@StuPig
StuPig / file
Created November 15, 2017 08:20
freedom_public
{"0.5948624295038616":"-----BEGIN PGP PUBLIC KEY BLOCK-----\r\nCharset: UTF-8\r\n\r\nxv8AAABSBAAAAAATCCqGSM49AwEHAgMEbP2Np3drW8PJcuu56YYZix3a1nZav7zg\r\nieEQefM7nKbUwywPWyWwZmjRrfMiW3YnOYOtZA6D0bSCXd0iTd9rnc3/AAAACDxn\r\naXRodWI+wv8AAACOBBATCABA/wAAAAWCWgv46P8AAAACiwn/AAAACZDTJGpWQDwt\r\nwv8AAAAFlQgJCgv/AAAABJYDAQL/AAAAApsD/wAAAAKeAQAAMCcA/0bxi7IwmNe2\r\n05BhjbAVUm76wnGMdf+nBY3QvV4da8VTAQCtpL11br+VnN9H3Fjt74P25coExy3o\r\ncaI9kW1naejTFs7/AAAAVgQAAAAAEggqhkjOPQMBBwIDBIp1elaRkVhBNChZ/wj1\r\n4tC44OnOXn6aT/WwSp/Ur1JIYALqjIYSP9DpWJPv3hj0eODviKRyLv4/2h4V4j9l\r\niFMDAQgHwv8AAABtBBgTCAAf/wAAAAWCWgv46P8AAAAJkNMkalZAPC3C/wAAAAKb\r\nDAAA6pIBAKZRmL3XzN7OF0OstQvZoAD3+HhBRH7qKXbrvZ2xJmSrAQDju+A10wsY\r\n8ksrkfValMIBPYRDNv6g9kBJno2Nr3dz9w==\r\n=IBWE\r\n-----END PGP PUBLIC KEY BLOCK-----\r\n"}
@StuPig
StuPig / finger.js
Created January 19, 2017 10:06
canvas test
/* AlloyFinger v0.1.2
* By dntzhang
* Github: https://github.com/AlloyTeam/AlloyFinger
*/
function getLen(v) {
return Math.sqrt(v.x * v.x + v.y * v.y);
}
function dot(v1, v2) {
return v1.x * v2.x + v1.y * v2.y;
@StuPig
StuPig / baoxiao.js
Created July 10, 2015 02:56
报销脚本,可以添加到书签里,在pig上的具体报销月份里,点击书签,会在页面高亮出可报销时间,在console里打出报销时间和报销数额
javascript:;(function() { var dates=[];document.querySelectorAll('html /deep/ .com-panel').array().forEach(function(item){var date=item.querySelector('.com-t-day').innerText;if(date.indexOf('/')!=-1)return;item=item.querySelector('.com-f-time');var endTime=item.children[1].innerText;endTime=endTime&&parseInt(endTime.split(":")[0]);if(endTime>=20||(endTime<6&&endTime>0)){dates.push(date);item.style.webkitBoxShadow="0 0 3px 3px red"}});console.log(dates.join(','),"共"+dates.length+"天,"+(dates.length*18)+"元") })()
@StuPig
StuPig / color.sh
Created December 10, 2014 07:47
shell echo 输出颜色
#!/bin/bash
RCol='\033[0m' # Text Reset
# Regular Bold Underline High Intensity BoldHigh Intens Background High Intensity Backgrounds
Bla='\033[0;30m'; BBla='\033[1;30m'; UBla='\033[4;30m'; IBla='\033[0;90m'; BIBla='\033[1;90m'; On_Bla='\033[40m'; On_IBla='\033[0;100m';
Red='\033[0;31m'; BRed='\033[1;31m'; URed='\033[4;31m'; IRed='\033[0;91m'; BIRed='\033[1;91m'; On_Red='\033[41m'; On_IRed='\033[0;101m';
Gre='\033[0;32m'; BGre='\033[1;32m'; UGre='\033[4;32m'; IGre='\033[0;92m'; BIGre='\033[1;92m'; On_Gre='\033[42m'; On_IGre='\033[0;102m';
Yel='\033[0;33m'; BYel='\033[1;33m'; UYel='\033[4;33m'; IYel='\033[0;93m'; BIYel='\033[1;93m'; On_Yel='\033[43m'; On_IYel='\033[0;103m';
Blu='\033[0;34m'; BBlu='\033[1;34m'; UBlu='\033[4;34m'; IBlu='\033[0;94m'; BIBlu='\033[1;94m'; On_Blu='\033[44m'; On_IBlu='\033[0;104m';
@StuPig
StuPig / pre-push
Created December 9, 2014 12:18
禁止直接向master和develop分之提交代码的钩子,放在.git/hooks/pre-push
#!/bin/bash
current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
if [ "$current_branch" = "master" ] || [ "$current_branch" = "develop" ]; then
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo ""
echo "禁止直接向master或develop分支提交代码!"
echo ""
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
exit 1
@StuPig
StuPig / clean_branch.sh
Created November 7, 2014 08:35
git分支清理脚本 script to clean git remote branches
#!/bin/bash
echo '***********************************';
echo '*';
echo -e '*\t分支清理';
echo '*';
echo '***********************************';
echo '';
# 切到主干分支develop,更新远程分支
@StuPig
StuPig / parseURI.js
Created June 19, 2014 13:49
parse URI to URI object like location object。URI转换,secheme转换
function parseURI (uri) {
"use strict";
if (!uri) return;
var regexMaybe = function (str) {
return '(?:' + str + ')?';
},
reg = new RegExp('^' + regexMaybe('(([^:]+):)?') + '\\/\\/([^:/]+)/*' + regexMaybe(':(\\d+)\\/*') + regexMaybe('([^?#]+)') + regexMaybe('\\?([^#]+)') + regexMaybe('#(\\w+)')),
match = uri.match(reg),
protocol = match[1] || '',
*{margin:0;padding:0;}
.grid {
padding: 600px 0;
background-repeat: repeat-y;
background-size: 1px auto;
}
@media screen and (max-width:480px) {
.grid {
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ccc), to(#ccc)), -webkit-gradient(linear, 0 0, 0 100%, from(#ccc), to(#ccc));
background-position:33% 0,66% 0;
input {
border: none;
border-bottom: 1px solid #01a34b;
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fff), to(#01a34b), color-stop(80%, #fff), color-stop(81%, #01a34b), color-stop(100%, #01a34b)),-webkit-gradient(linear, 0 0, 0 100%, from(#fff), to(#01a34b), color-stop(80%, #fff), color-stop(81%, #01a34b), color-stop(100%, #01a34b));
background-size: 1px 100%;
background-position: 0 0, 100% 0;
background-repeat: no-repeat;
}
input:focus,
@StuPig
StuPig / shuffle.js
Created March 6, 2014 02:41
shufle js洗牌算法
// more on: http://jsperf.com/js-shuffle-test/2
/**
* 数组洗牌算法
* @param arr
*/
function shuffle(arr) {
var s = [];
while (arr.length) s.push(arr.splice(Math.random() * arr.length, 1)[0]);
arr = arr.concat(s);