Skip to content

Instantly share code, notes, and snippets.

@lenye
lenye / unwxapkg.py
Created May 26, 2022 15:27 — forked from Integ/unwxapkg.py
A useful tool for unpack wxapkg file with python3 surport.
# coding: utf-8
# py2 origin author lrdcq
# usage python3 unwxapkg.py filename
__author__ = 'Integ: https://github.com./integ'
import sys, os
import struct
class WxapkgFile(object):
@lenye
lenye / rev_proxy.go
Created December 27, 2021 02:30 — forked from viggin543/rev_proxy.go
rev_proxy.go
package reverse_proxy
import (
"bytes"
"fmt"
"github.com/viggin/svc-api-gateway/internal/models"
"github.com/gin-gonic/gin"
"github.com/google/uuid"
"github.com/palantir/stacktrace"
"github.com/sirupsen/logrus"
@lenye
lenye / libvips-installer.sh
Created September 8, 2020 08:16 — forked from h2non/libvips-installer.sh
libvips 7.42.x cross-platform simple installer script (supports OSX, Debian, Ubuntu, CentOS, Fedora, Amazon Linux)
#!/bin/sh
#
# Orinally made by Lovell Fuller for sharp
# https://github.com/lovell/sharp
#
# Usage:
# curl -s https://gist.github.com/h2non/89bb2f87c6499d0b25f1/raw/bf3d0743107f02f5db2b93c53f7f0e07a1c33112/libvips-installer.sh | sudo bash -
#
@lenye
lenye / docker-compose.yml
Created May 29, 2020 02:22 — forked from smashnet/docker-compose.yml
Docker-Compose: Mastodon v3.1.4 with Traefik v2.2
version: '3'
# Variables to fill in:
# Line 23: <LETSENCRYPT_MAIL_ADDRESS> - your mail address for contact with Let's Encrypt
# Line 36: <TRAEFIK_DASHBOARD_ADMIN_PASSWORD> - MD5 hash of your password (use http://www.htaccesstools.com/htpasswd-generator/)
# Line 54: <POSTGRES_PASSWORD> - the password for the postgres db. Use the same during mastodon:setup!
# Lines 31, 86, 111: <DOMAIN> - e.g. social.yourdomain.com (Must have an A record pointing to your box' IP) (AAAA for IPv6 ;)
services:
traefik:
@lenye
lenye / fnv_example.go
Created March 17, 2020 07:34 — forked from lenage/fnv_example.go
golang fnv example
package main
import (
"bufio"
"fmt"
"hash/fnv"
"io"
"os"
)
@lenye
lenye / rabbitmq_client.go
Created September 27, 2018 14:58 — forked from urey-hiker/rabbitmq_client.go
rabbitmq client in golang.
package client
import (
"context"
"crypto/md5"
"crypto/tls"
"encoding/json"
"errors"
"fmt"
"net"
# use with: logging.config.dictConfig(yaml.load(open('logging.yaml', 'r')))
# Formatters detailed here: http://docs.python.org/2/library/logging.html#logrecord-attributes
version: 1
formatters:
simple:
format: '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
detail:
format: '%(asctime)s - %(levelname)s - File: %(filename)s - %(funcName)s() - Line: %(lineno)d - %(message)s'
#!/usr/bin/env python
"""
Dummy SMTP server accepting everything and storing message to disk.
Useful for unit testing.
"""
import asyncore
import time
import os
import os.path
@lenye
lenye / tree.md
Created April 10, 2014 01:10 — forked from hrldcpr/tree.md

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@lenye
lenye / dnspod动态dns更新.py
Last active November 5, 2020 01:42
dnspod动态dns更新
# -*- coding: utf-8 -*-
"""
Created on 2014-02-09
__author__ = DuanShiMing
__mail__ = [email protected]
dnspod动态dns更新
五分钟更新一次, 运行crontab -e, 编辑:
*/5 * * * * python /home/lenye/dnspod_ddns.py