Skip to content

Instantly share code, notes, and snippets.

View wangxufire's full-sized avatar
💭
I may be slow to respond.

星野はじめ wangxufire

💭
I may be slow to respond.
View GitHub Profile
@wangxufire
wangxufire / pack_tg_stickers.js
Created April 18, 2018 07:03
batch pack telegram stickers from web.telegram.org
(function () {
if(document.location.hostname !== "web.telegram.org") {
alert("This script can only be used on web.telegram.org");
return;
}
if (!document.querySelector("[ng-bind=\"stickerset.title\"]")) {
var smInfo = `Sticker modal not open! Please open the sticker modal before continuing.
Example:
https://t.me/addstickers/LoZTriforceHeroes
@wangxufire
wangxufire / TrueColour.md
Created November 7, 2017 15:03 — forked from XVilka/TrueColour.md
True Colour (16 million colours) support in various terminal applications and terminals

Colours in terminal

It's a common confusion about terminal colours... Actually we have this:

  • plain ascii
  • ansi escape codes (16 colour codes with bold/italic and background)
  • 256 colour palette (216 colours + 16 ansi + 24 gray) (colors are 24bit)
  • 24bit true colour ("888" colours (aka 16 milion))
printf "\x1b[${bg};2;${red};${green};${blue}m\n"
@wangxufire
wangxufire / gopool.go
Created October 21, 2017 07:24
Goroutine Pool
package main
import (
"fmt"
"sync"
)
type worker struct {
Func func()
}
@wangxufire
wangxufire / progress_bar.py
Created September 1, 2017 06:54
python progress bar in the console
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Print iterations progress
def print_progress(iteration, total, prefix='', suffix='', decimals=1, bar_length=100):
"""
Call in a loop to create terminal progress bar
@params:
iteration - Required : current iteration (Int)
total - Required : total iterations (Int)
@wangxufire
wangxufire / coroutine.py
Last active September 1, 2017 06:53
Python3.5+ EventLoop
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import asyncio
"""
async/await:
把@asyncio.coroutine替换为async;
把yield from替换为await。
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import atexit
import errno
import os
import sys
import time
import signal
@wangxufire
wangxufire / socks5.go
Created August 23, 2017 15:35
Go simple socks5 proxy
package main
import (
"io"
"log"
"net"
"strconv"
)
func main() {
@wangxufire
wangxufire / cloudSettings
Last active July 17, 2019 03:19
Visual Studio Code Sync Settings
{"lastUpload":"2019-07-17T03:19:42.986Z","extensionVersion":"v3.3.1"}