Skip to content

Instantly share code, notes, and snippets.

View jackect's full-sized avatar
🎯
Focusing

Hell Jibe jackect

🎯
Focusing
  • Sichuan, China
View GitHub Profile
@bookfere
bookfere / fix-google-translate-cn.bat
Last active March 29, 2025 05:50
Fix Google Translate CN for Windows
:: Copyright (c)2022 https://bookfere.com
:: This is a batch script for fixing Google Translate and making it available
:: in the Chinese mainland. If you experience any problem, visit the page below:
:: https://bookfere.com/post/1020.html
@echo off
setlocal enabledelayedexpansion
chcp 437 >NUL
set "ips[0]=74.125.137.90"
@bookfere
bookfere / fix-google-translate-cn.sh
Last active December 18, 2024 04:59
Fix Google Translate CN for macOS
#!/bin/bash
# Copyright (c)2022 https://bookfere.com
# This is a batch script for fixing Google Translate and making it available
# in the Chinese mainland. If you experience any problem, visit the page below:
# https://bookfere.com/post/1020.html
set -e
IPS=(
74.125.137.90
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.xml with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:4443
import BaseHTTPServer, SimpleHTTPServer
import ssl
@nicky-zs
nicky-zs / make_safely_shutdown.py
Created August 22, 2013 09:10
Make the tornado httpserver.HTTPServer to be shutdown safely.
# vim: fileencoding=utf-8
import time, signal
from tornado import web, ioloop, options, httpserver
_SHUTDOWN_TIMEOUT = 30
def make_safely_shutdown(server):
io_loop = server.io_loop or ioloop.IOLoop.instance()
def stop_handler(*args, **keywords):
def shutdown():
@cdown
cdown / gist:1163649
Last active April 14, 2025 22:42
Bash urlencode and urldecode
urlencode() {
# urlencode <string>
old_lc_collate=$LC_COLLATE
LC_COLLATE=C
local length="${#1}"
for (( i = 0; i < length; i++ )); do
local c="${1:$i:1}"
case $c in