Skip to content

Instantly share code, notes, and snippets.

View changkun's full-sized avatar
🏠
https://changkun.de

Changkun Ou changkun

🏠
https://changkun.de
View GitHub Profile
@changkun
changkun / print-memory.go
Created August 13, 2023 12:57 — forked from j33ty/print-memory.go
Go print current memory
package main
import (
"runtime"
"fmt"
"time"
)
func main() {
// Print our starting memory usage (should be around 0mb)
@changkun
changkun / sendmail.py
Created April 11, 2017 13:59
Python Email Sender for QQ Mail
from email.mime.text import MIMEText
from email.header import Header
from smtplib import SMTP_SSL
# qq mail sending server
host_server = 'smtp.qq.com'
sender_mail = 'SENDER_MAIL'
sender_passcode = 'PASS_CODE'
# receiver mail
@changkun
changkun / stable_diffusion_prompt.txt
Created March 8, 2023 18:11 — forked from voodoohop/chatgpt_image_generation.txt
Allow ChatGPT to generate images using Stable Diffusion
You will now act as a prompt generator.
I will describe an image to you, and you will create a prompt that could be used for image-generation.
Once i described the image, give a 5 word summary and then include the following (markdown)
![Image](https://image.pollinations.ai/prompt/{description}), where {description} = {sceneDetailed},%20{adjective1},%20{charactersDetailed},%20{adjective2},%20{visualStyle1},%20{visualStyle2},%20{visualStyle3},%20{genre},%20{artistReference}
@changkun
changkun / postgres_queries_and_commands.sql
Created February 7, 2023 11:54 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@changkun
changkun / cmd.sh
Created August 25, 2022 09:44 — forked from kelvinn/cmd.sh
Example of using Apache Bench (ab) to POST JSON to an API
# post_loc.txt contains the json you want to post
# -p means to POST it
# -H adds an Auth header (could be Basic or Token)
# -T sets the Content-Type
# -c is concurrent clients
# -n is the number of requests to run in the test
ab -p post_loc.txt -T application/json -H 'Authorization: Token abcd1234' -c 10 -n 2000 http://example.com/api/v1/locations/
@changkun
changkun / occamy.js
Created November 21, 2019 21:52
occamy.js
var Guacamole = Guacamole || {};
/**
* A reader which automatically handles the given input stream, returning
* strictly received packets as array buffers. Note that this object will
* overwrite any installed event handlers on the given Guacamole.InputStream.
*
* @constructor
* @param {Guacamole.InputStream} stream The stream that data will be read
* from.
@changkun
changkun / diffusion_tutorial.ipynb
Created August 17, 2022 11:26 — forked from mwaskom/diffusion_tutorial.ipynb
Translation of Justin Gardner's drift diffusion tutorial from MATLAB into Python
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@changkun
changkun / all.md
Last active August 2, 2022 04:17
Go History

The Go History

This document includes all interesting issues, discussions, proposals, and CLs in the Go development history, which intents to offer a comprehensive reference of Go history.

Authors

Core Founders

@changkun
changkun / cgo.md
Created May 3, 2022 07:16 — forked from zchee/cgo.md
cgo convert list

See also, http://libraryofalexandria.io/cgo/

Using Go cgo

cgo has a lot of trap.
but Not "C" pkg also directory in $GOROOT/src. IDE's(vim) Goto command not works.

So, Here collect materials.

@changkun
changkun / Makefile
Created March 3, 2022 19:04 — forked from EXL/1-ReadMe.md
OpenGLES for Linux example
all:
$(CC) *.c -lm `sdl2-config --cflags` `sdl2-config --libs` -lEGL -lGLESv1_CM -o gles_linux
clean:
-rm -f gles_linux
-rm -f *.o