Skip to content

Instantly share code, notes, and snippets.

View linkerlin's full-sized avatar
🎯
Focusing

Halo Master linkerlin

🎯
Focusing
View GitHub Profile
@ProGamerGov
ProGamerGov / replace_vae.py
Last active December 26, 2023 07:15
Replace the VAE in a Stable Diffusion model with a new VAE. Tested on v1.4 & v1.5 SD models
# Script by https://github.com/ProGamerGov
import copy
import torch
# Path to model and VAE files that you want to merge
vae_file_path = "vae-ft-mse-840000-ema-pruned.ckpt"
model_file_path = "v1-5-pruned-emaonly.ckpt"
# Name to use for new model file
(messageGateway ? SendMessageToClientRequest (
id = id,
phoneNumber = pNumber,
msg = message
)).mapTo[SendMessageToClientResponse] onComplete {
case Success(res) => res match {
case SendMessageToClientResponse(true) =>
currentSender ! SendCustomMessageResponse(true)
case SendMessageToClientResponse(false) =>
currentSender ! SendCustomMessageResponse(false)
@posener
posener / go-shebang-story.md
Last active March 29, 2024 08:38
Story: Writing Scripts with Go

Story: Writing Scripts with Go

This is a story about how I tried to use Go for scripting. In this story, I’ll discuss the need for a Go script, how we would expect it to behave and the possible implementations; During the discussion I’ll deep dive to scripts, shells, and shebangs. Finally, we’ll discuss solutions that will make Go scripts work.

Why Go is good for scripting?

While python and bash are popular scripting languages, C, C++ and Java are not used for scripts at all, and some languages are somewhere in between.

@journey-ad
journey-ad / bilibili_api.lua
Created June 15, 2017 11:34 — forked from mimosa/bilibili_api.lua
B站 api key 规则,每3小时轮换一个 :(
function string.fh(str)
return (str:gsub('..', function (cc)
return string.char(tonumber(cc, 16))
end))
end
function sort_nums()
return ("6337393836663535306539363566613865616264646435653033363665356466"):fh()
end
bit = require('bit')
@ifels
ifels / golang_pipe_http_response.go
Last active February 1, 2023 19:19
golang pipe the http response
package main
import (
"io"
"net/http"
"os/exec"
)
var (
BUF_LEN = 1024
@jniltinho
jniltinho / myip.go
Created March 26, 2014 16:55
Get My IP Golang
package main
/*
URL: https://github.com/mccoyst/myip/blob/master/myip.go
URL: http://changsijay.com/2013/07/28/golang-get-ip-address/
*/
import (
"net"
"os"
(ns echo-server
(:import (java.net InetAddress DatagramPacket DatagramSocket)))
(def udp-server (ref nil))
(def port 12345)
(defn localhost [] (. InetAddress getLocalHost))
(defn message [text]
@linkerlin
linkerlin / with_timer.py
Last active December 19, 2015 16:09
一个简单的Python计时器
class Timer(object):
def __init__(self, name):
print("%s: " % name, end="")
def __enter__(self):
self.t0 = time.time()
def __exit__(self, *args):
print("%.3fs" % (time.time() - self.t0))
with Timer("XXX"):
call_function()
@linkerlin
linkerlin / classpathhacker.py
Last active December 11, 2015 20:18
A jar loader for jython. If you want add some jars to JVM in Jython, you can use the following class. Modified from: http://www.jython.org/jythonbook/en/1.0/appendixB.html#working-with-classpath 这是一个修改版本的classPathHacker,用于在Jython里加载一个Jar给Java Code使用。不同于在sys.path里面添加jar。此方法可以让JavaCode也使用到新加载的Jar,而不仅仅是JythonCode. 添加sys.path的方法参见:http://my.oschina.…
class ClassPathHacker :
##########################################################
# from http://forum.java.sun.com/thread.jspa?threadID=300557
#
# Author: SG Langer Jan 2007 translated the above Java to this
# Jython class
# Modified by: Linker Lin linker.lin@me.com
# Purpose: Allow runtime additions of new Class/jars either from
# local files or URL
######################################################
@flyingnn
flyingnn / gist:4174171
Created November 30, 2012 06:45 — forked from ego008/gist:897638
GAE Nginx proxy
upstream ghs {
ip_hash;
server ghs.google.com;
server 72.14.203.121;
server 72.14.207.121;
server 74.125.43.121;
server 74.125.47.121;
server 74.125.53.121;
server 74.125.77.121;
server 74.125.93.121;