Skip to content

Instantly share code, notes, and snippets.

@donziv
donziv / folder_splitter.py
Last active February 24, 2019 13:41 — forked from zupo/folder_splitter.py
Split a folder with many files into subfolders with N files.Usage: python folder_splitter.py path/to/target/folder
# -*- coding: utf-8 -*-
# @author: Peter Lamut
import argparse
import os
import shutil
N = 100 # the number of files in seach subfolder folder
@donziv
donziv / FileServer.py
Created November 1, 2018 03:11 — forked from debuggerx01/FileServer.py
基于修改过的python3的http.server的脚本再次修改而来支持文件上传下载及双向剪切板操作的python3脚本,支持pc(需要pyperclip库)及安卓(需要termux:api)
#!/usr/bin/env python3
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
see: https://gist.github.com/UniIsland/3346170
"""
@donziv
donziv / WeiboUtil.js
Created June 8, 2018 00:11 — forked from fengmk2/WeiboUtil.js
新浪微博mid与url互转实用工具
/**
* 新浪微博mid与url互转实用工具
* 作者: XiNGRZ (http://weibo.com/xingrz)
*/
var WeiboUtil = {
// 62进制字典
str62keys: [
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z",
@donziv
donziv / clear.txt
Created April 10, 2018 07:45 — forked from EQuimper/clear.txt
React-Native clear Watchman + Cache
watchman watch-del-all && rm -rf node_modules/ && yarn cache clean && yarn install && yarn start -- --reset-cache
...
@Override
protected List<ReactPackage> getPackages() {
Context context = getApplicationContext();
// This is the Fresco config, do anything custom you want here
ImagePipelineConfig frescoConfig = ImagePipelineConfig
.newBuilder(context)
.setBitmapMemoryCacheParamsSupplier(new CustomBitmapMemoryCacheParamsSupplier(context))
import android.app.ActivityManager;
import android.content.Context;
import android.os.Build;
import com.facebook.common.internal.Supplier;
import com.facebook.common.util.ByteConstants;
import com.facebook.imagepipeline.cache.DefaultBitmapMemoryCacheParamsSupplier;
import com.facebook.imagepipeline.cache.MemoryCacheParams;
/**
// ==UserScript==
// @name simplenote toggle sidebar
// @namespace http://calon.weblogs.us/
// @version 0.1
// @description Button in footer to hide Simplenote siadebar.
// @match https://app.simplenote.com/*
// @include https://app.simplenote.com/*
// @match http://app.simplenote.com/*
// @include http://app.simplenote.com/*
// @supportURL calon.xu@gmail.com
@donziv
donziv / combineTS.py
Created February 22, 2018 08:08 — forked from ranlix/combineTS.py
将同一目录下所有.ts文件合并到一个新的.ts文件(PS: .ts文件是可以直接合并的视频文件,因此可以这样合并)
# -*-coding: utf-8 -*-
import sys
import os
num = sys.argv[1] # num is the amount of *.ts files
def add(x):
"""'x' is the amount of *.ts
This function should add all other .ts combined into '1.ts'
@donziv
donziv / npm.taobao.sh
Created January 19, 2018 07:13 — forked from 52cik/npm.taobao.sh
npm 淘宝镜像配置
npm set registry https://registry.npm.taobao.org # 注册模块镜像
npm set disturl https://npm.taobao.org/dist # node-gyp 编译依赖的 node 源码镜像
## 以下选择添加
npm set chromedriver_cdnurl http://cdn.npm.taobao.org/dist/chromedriver # chromedriver 二进制包镜像
npm set operadriver_cdnurl http://cdn.npm.taobao.org/dist/operadriver # operadriver 二进制包镜像
npm set phantomjs_cdnurl http://cdn.npm.taobao.org/dist/phantomjs # phantomjs 二进制包镜像
npm set sass_binary_site http://cdn.npm.taobao.org/dist/node-sass # node-sass 二进制包镜像
npm set electron_mirror http://cdn.npm.taobao.org/dist/electron/ # electron 二进制包镜像
@donziv
donziv / WebViewBridge.js
Created December 25, 2017 03:03 — forked from blankg/WebViewBridge.js
Provides a sample implementation for sending and receiving messages to and from the React-Native WebView (using postMessage/onMessage WebView API).
/**
* Created by Guy Blank on 3/9/17.
*
* This is a sample provides an API to send & receive messages to and from the React-Native WebView (using postMessage/onMessage WebView API).
*
* webViewBridge.send('functionToInvoke', {mydata: 'test'}, function(){console.log('success')},function(){console.log('error')});
*
* The API is designed to be similar to the Cordova exec API so migration to it should be almost seamless.
* The API also provides solution to a React-Native WebView bug in iOS which causes sending consecutive postMessage calls to override each other.
*