Skip to content

Instantly share code, notes, and snippets.

@lwr
lwr / Launcher.java
Created August 27, 2021 09:33
cn.mailtech.maven.resolver
/*
* Copyright (c) 2020 Mailtech.cn, Ltd. All Rights Reserved.
*/
package cn.mailtech.maven.resolver;
import java.io.*;
import java.lang.reflect.Method;
import java.net.*;
import java.util.*;
@lwr
lwr / LangUtils.java
Last active April 27, 2017 14:32
a simple code demonstrating what java primitive type is
// the implemention of getPrimitiveWrapperClass & getPrimitiveClass
public static <T> Class<T> getPrimitiveWrapperClass(Class<T> primitiveClass) {
if ((primitiveClass == null) || !primitiveClass.isPrimitive()) {
throw new IllegalArgumentException("Not a primitive class: " + primitiveClass);
}
String name = primitiveClass.getName();
if (primitiveClass == int.class) {
@lwr
lwr / checkstyle.xml
Created March 15, 2016 15:08
Java CheckStyle config file
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.2//EN"
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
<module name="Checker">
<!-- Checks that property files contain the same keys. -->
<!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
<module name="Translation"/>
@lwr
lwr / StringFormat.js
Last active February 19, 2020 09:58
String.format
String.format = function(pattern/*, args ... */) {
var result = "";
function parse() {
// %[argument_index$][flags][width][.precision][conversion]
// $0 - the entire matched part
// $1 - argument_index '$'
// $2 - flags
// $3 - width
@lwr
lwr / ytdl
Last active August 29, 2015 14:01 — forked from ckorn/ytdl
compatible with ffmpeg 2.2
#!/bin/bash
#Youtube-DL DASH Video and Audio merging script
#Written by QuidsUp
#Edited by Christoph Korn
#Edited by William Leung
File1New=video.mp4
File2New=audio.m4a
URL=$1
_vcs_info() {
# parse git branch
git name-rev HEAD 2> /dev/null | sed 's#HEAD\ \(.*\)#git:\1)#' | grep git && return
# parse svn branch
# http://svn.host/xxx
REPO_ROOT=`svn info 2>/dev/null | sed -ne 's#^Repository Root: ##p'`
[ -z "$REPO_ROOT" ] && return
# http://svn.host/xxx -> 空串
# http://svn.host/xxx/trunk -> /trunk
# http://svn.host/xxx/branches/yyy/zzz -> /branches/yyy/zzz
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Blue Component</key>
<real>0.19370138645172119</real>
<key>Green Component</key>
<real>0.15575926005840302</real>
@lwr
lwr / autopac.sh
Last active February 13, 2020 07:35
使用 https://github.com/clowwindy/gfwlist2pac 生成自定义 PAC 的辅助脚本
#!/bin/bash
GFWLIST=https://autoproxy-gfwlist.googlecode.com/svn/trunk/gfwlist.txt
PROXY=127.0.0.1:7070
cd `dirname "${BASH_SOURCE[0]}"`
echo "Downloading gfwlist from $GFWLIST"
curl "$GFWLIST" --socks5-hostname "$PROXY" > /tmp/gfwlist.txt
/usr/local/bin/gfwlist2pac \
--input /tmp/gfwlist.txt \
# -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
import requests
username = '' ###账号###
password = '' ###密码###
login_url = 'http://v2ex.com/signin' ###如V2EX设置了使用 SSL,必须改 https###
index_url = 'http://v2ex.com' ###同上###
mission_url = 'http://www.v2ex.com/mission/daily' ###同上###
UA = "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) \