Skip to content

Instantly share code, notes, and snippets.

@hugozhu
hugozhu / base_config.yaml
Created August 14, 2021 02:08 — forked from allen0125/base_config.yaml
SurfShark Shadowsocks IP 列表文件转 Clash配置文件脚本
#---------------------------------------------------#
## 配置文件需要放置在 $HOME/.config/clash/config.yml
##
## 如果您不知道如何操作,请参阅 SS-Rule-Snippet 的 Wiki:
## https://github.com/Hackl0us/SS-Rule-Snippet/wiki/clash(X)
#---------------------------------------------------#
# HTTP 代理端口
port: 7890
@hugozhu
hugozhu / XSSFilter.filter
Created August 28, 2014 08:25
XSSFilter
package web.filter
import java.io.IOException;
import java.text.Normalizer;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;
package main
import (
"io/ioutil"
"log"
"net"
"net/http"
"net/url"
"strings"
"time"
#!/usr/bin/python
#
# based on code from lrvick and LiquidCrystal
# lrvic - https://github.com/lrvick/raspi-hd44780/blob/master/hd44780.py
# LiquidCrystal - https://github.com/arduino/Arduino/blob/master/libraries/LiquidCrystal/LiquidCrystal.cpp
#
from time import sleep
from datetime import datetime
@hugozhu
hugozhu / du.go
Last active December 20, 2015 14:29
Another Go script to count folder size
package main
import (
"fmt"
"os"
"runtime"
"sync"
"sync/atomic"
"time"
)
@hugozhu
hugozhu / du.go
Last active December 20, 2015 10:09
A Go script to count folder size.
package main
import (
"os"
"runtime"
"log"
"time"
)
var dir string
@hugozhu
hugozhu / Main.java
Last active December 16, 2015 07:58
线程等待依赖服务初始化成功 (for android)
package com.github.hugozhu.thread_wait_for_another_s_signal;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
/**
* 线程等待依赖服务初始化成功 (for android)
* User: hugozhu
@hugozhu
hugozhu / gist:5289546
Created April 2, 2013 02:42
Pi的cosm脚本
#!/bin/bash
LOCATION=''
API_KEY=''
FEED_ID=''
####################################################
COSM_URL=http://api.cosm.com/v2/feeds/$FEED_ID?timezone=+8
cpu_load=`cat /proc/loadavg | awk '{print $2}'`
package main
import (
"encoding/json"
"log"
"os"
)
type Result struct {
WeatherInfo *WeatherInfo
@hugozhu
hugozhu / douban.php
Created January 3, 2013 05:10
Raspberry Pi上听豆瓣电台的简易方法:sudo apt-get install mpg123 php5-cli,然后执行本程序即可
#!/usr/bin/env php
<?php
function fetch_page($url, $timeout = 5) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$data = curl_exec($ch);
curl_close($ch);