Skip to content

Instantly share code, notes, and snippets.

View yantze's full-sized avatar
🤤
Out sick

zhi yantze

🤤
Out sick
View GitHub Profile
@yantze
yantze / backup_tweets.md
Created June 20, 2017 13:53
backup your favourite tweets

steps

  • 打开你自己的twitter web page
  • 加载完你所有喜欢的推
  • 运行代码去掉无关的内容
  • 打印当前页面或者保存当前页面
  • Done
document.tweet = {}
@yantze
yantze / test.ipynb
Created June 19, 2017 03:21
python jupyter notebook opencv course
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yantze
yantze / webdl.sh
Last active December 9, 2024 06:28
wget 整站下载
# 使用 wget 下载整个网站解释
# link: https://www.douban.com/note/536265958
# wget
# --recursive //回归递推也就是包括所有子目录子文件
# --no-clobber //不更改已经存在的文件,也不使用在文件名后添加 .#(# 为数字)的方法写入新的文件
# --page-requisites //下载所有显示完整网页所需的文件,例如图像。
# --html-extension //将所有text/html文档以.html扩展名保存
# --convert-links //转换非相对链接为相对链接
# --no-parent //不要追溯到父目录
# --level=0 // Specify recursion maximum depth level depth.
@yantze
yantze / runTerminal.js
Created March 5, 2017 16:21
JavaScript for Automator 在当前命令行运行指定命令
/**
run command in current Terminal.app
how to run:
osascript ./runTerminal.js
osascript -l JavaScript -e 'Application("iTunes").currentTrack.name()'
*/
function commandExistWindow(command) {
@yantze
yantze / .translate_functions
Last active March 5, 2018 07:49
translate in command 在命令行里翻译和查词典
# author: yantze
# date: 2016-08-18
# require command `jq` : https://stedolan.github.io/jq/
# less is more
# google api
trsi () {
# google api only support + concat
words=`echo $* | sed 's/ /+/g'`
key='balabana' # 需要提供谷歌服务 key
@yantze
yantze / post_pre_inc.php
Last active August 18, 2016 11:06
php 奇怪的自增和运算符执行顺序分析 some weird evaluation about post_inc and pre_inc
<?php
// author: yantze
// date: 2016-07-31
// desc: php 自增和运算符执行顺序分析
// #1
function test1(){
echo PHP_EOL.__function__ .":";
$a=1;
echo (++$a)+(++$a);
@yantze
yantze / ipurl.sh
Last active July 1, 2016 05:08
get pure ip from url
#!/bin/sh
# get pure ip from url
function ipurl() {
echo $1 |
sed -e 's/^.*:\/\/\(.*\)/\1/g' | # remove http(s)://
awk -F/ '{print $1}' | # remove /query/abc?a=b
xargs ping -c 1 -t 1 | # -c only send one package, -t timeout 1s
sed -n '1p' | # result: get first line
sed -e 's/^.*(\([0-9\.]\{7,\}\)).*/\1/g' # get ip in the first line
function addScript( src,callback) {
var s = document.createElement( 'script' );
s.setAttribute( 'src', src );
s.onload=callback;
document.body.appendChild( s );
}
@yantze
yantze / MysqlHelper.php
Last active November 10, 2015 14:01
MysqlHelper can get select fields full info with no result 获取 select 结果集的字段信息
<?php
/**
* Created by PhpStorm.
* User: yantze.yang
* Date: 2015/11/7
* Time: 18:05
*/
namespace app\helpers\db;
// user:password@host:port\database
@yantze
yantze / emptiness_and_arrays.php
Last active September 16, 2015 07:22
NULL is equal ''
<?php
// http://www.phpwtf.org/
$a = array();
$a[''] = 'string index';
$a[NULL] = 'NULL index';
$a[] = 'add index';
var_dump($a);
// NULL is equal ''