Skip to content

Instantly share code, notes, and snippets.

View codeskyblue's full-sized avatar

codeskyblue codeskyblue

View GitHub Profile
@codeskyblue
codeskyblue / gen_supervisor_conf.py
Created November 1, 2022 08:40
Generate supervisor config file through yaml
#!/usr/bin/env python3
# coding: utf-8
#
"""
Refs:
- https://jinja.palletsprojects.com/en/3.1.x/templates/
- https://stackoverflow.com/questions/39288706/jinja2-load-template-from-string-typeerror-no-loader-for-this-environment-spec
改进型的yaml,支持符号~,增加默认配置redirect_stderr,stopasgroup,killasgroup,directory,user,stdout_logfile_backups=1,environment增加PATH
@codeskyblue
codeskyblue / html2image.js
Created February 19, 2019 04:32
Convert html file into image using Google puppeteer
const puppeteer = require('puppeteer');
const resolve = require("path").resolve;
// node html2image.js -i input.html -o output.png
(async () => {
var program = require("commander");
program
.version("0.1.0")
.option("-i, --input <path>", "input html")
@codeskyblue
codeskyblue / http-proxy.go
Created January 18, 2019 05:17
HTTP Proxy implement in go
package main
import (
"encoding/base64"
"flag"
"fmt"
"io"
"net"
"net/http"
"strings"
@codeskyblue
codeskyblue / notch_screenshot.py
Created September 10, 2018 07:43
uiautomator2刘海屏截图代码
# coding: utf-8
#
from PIL import Image, ImageDraw
class Notch(object):
def __init__(self, d):
self.d = d
self.brand = self.d.device_info['brand']
self.model = self.d.device_info['model']
@codeskyblue
codeskyblue / OUTPUT.txt
Created December 27, 2017 07:27
study of levenshtein_distance
[[0 1 2 3 4 5 6]
[1 2 3 4 5 6 7]
[2 3 2 4 6 7 8]
[3 4 3 2 4 6 8]
[4 5 4 3 2 4 6]
[5 6 5 4 3 5 7]
[6 7 6 5 4 6 5]
[7 8 7 6 5 7 6]]
[[1 1 1 1 1 1 1]
[0 0 0 0 0 0 0]
@codeskyblue
codeskyblue / websocket-relay.go
Last active July 5, 2017 11:36
Convert https://github.com/phoboslab/jsmpeg websocket-relay.js to Go language
package main
import (
"log"
"net/http"
"sync"
"github.com/gorilla/websocket"
)
@codeskyblue
codeskyblue / README.md
Last active July 21, 2016 07:01
run command and kill by env

Install

pip install psutil

Usage

./safe_run.py bash long_script.sh
package com.example.hzsunshx.helloworld;
import android.content.Context;
import android.content.Intent;
import android.support.test.InstrumentationRegistry;
import android.support.test.uiautomator.By;
import android.support.test.uiautomator.UiDevice;
import android.support.test.uiautomator.UiObject;
import android.support.test.uiautomator.UiObject2;
import android.support.test.uiautomator.Until;
@codeskyblue
codeskyblue / app_.gitignore
Created December 11, 2015 07:15
android studio, uiautomator
/build
@codeskyblue
codeskyblue / which.py
Created July 28, 2015 08:16
Find python lib path
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Author: hzsunshx
# Created: 2015-06-01 15:56
"""
find python lib path
"""