Skip to content

Instantly share code, notes, and snippets.

View NewFuture's full-sized avatar
🖥️
:octocat:

New Future NewFuture

🖥️
:octocat:
View GitHub Profile
var YYF_CONSOLE = {
_console: function(method) {
return function() {
setTimeout(console[method].bind.apply(console[method], [console].concat(Array.prototype.slice.call(arguments))));
}
}
};
['assert','clear','count','debug','dir','dirxml','error','group','groupCollapsed','groupEnd','info','log','profile','profileEnd','time','timeEnd','timeStamp','warn'].forEach(function(method) {
YYF_CONSOLE[method] = YYF_CONSOLE._console(method);
@NewFuture
NewFuture / mapreduce
Last active October 18, 2016 17:32
yes! hadoop
#!/usr/bin/env bash
# 模拟单个mapper和reducer
SORT='-k1,1'
if [ $# -lt 2 ] ; then
echo "USAGE:"
echo " $0 inputfile mapper"; #双参数
echo " $0 inputfile mapper reducer ";#三参数
echo " $0 inputfile mapper reducer SORT_ARGS";#多参数
echo " -default [SORT_ARGS]: '$SORT'";
@NewFuture
NewFuture / backup.sh
Last active October 16, 2016 05:10
mysql backup
#!/bin/bash
MAXIMUM_BACKUP_FILES=10 #最大备份文件数
BACKUP_FOLDERNAME="/var/db/backup/" #数据库备份文件的主目录
DB_HOSTNAME="localhost" #mysql所在主机的主机名
DB_USERNAME="backupaccount" #mysql登录用户名
DB_PASSWORD="backuppassword" #mysql登录密码
DATABASES=(
"dbname" #备份的数据库名
)
@NewFuture
NewFuture / Github.reg
Last active October 22, 2016 08:08
putty theme
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions\Github]
"Colour0"="62,62,62"
"Colour1"="201,85,0"
"Colour2"="244,244,244"
"Colour3"="244,244,244"
"Colour4"="63,63,63"
"Colour5"="62,62,62"
"Colour6"="62,62,62"
@NewFuture
NewFuture / sslocal
Last active October 22, 2016 11:44 — forked from Jimmy-Xu/sslocal
/etc/init.d/sslocal
#!/bin/bash
set -e
### BEGIN INIT INFO
# Provides: sslocal
# Required-Start: $syslog $remote_fs
# Required-Stop: $syslog $remote_fs
# Should-Start:
# Should-Stop:
# Default-Start: 2 3 4 5
alias YAF='docker run -it --rm -p8080:80 -v"$(pwd)":/newfuture/yaf newfuture/yaf'
#删除文件和历史记录
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch {path-of-remove-file}' --prune-empty --tag-name-filter cat -- --all
#删除远程分支
git push origin --delete {branchname}
git push origin --delete tag {tag name}
@NewFuture
NewFuture / b.py
Last active August 27, 2017 09:42
#!/usr/bin/env python3
import collections
def get_isosceles_trapezoid_num(edges):
d={}
sorted(edges)
for edge in edges:
d[edge] = d.get(edge,0) + 1
#字典排序
declare global {
interface Date {
format(fmt: string): string;
isToday(): boolean;
}
}
let week = ["一", "二", "三", "四", "五", "六", "日"];
let week_pre = ["", "周", "星期"];
Date.prototype.format = function (fmt: string): string {
var o = {
rm -rf /data/data/com.chaozhuo.texteditor.phoenixos
rm -rf /data/data/com.chaozhuo.filemanager.phoenixos
rm -rf /data/data/com.chaozhuo.browser.x86
rm -rf /data/data/com.tencent.tmgp.pubgmhd/files/tss_tmp
echo "O98K"