Skip to content

Instantly share code, notes, and snippets.

View HenryQW's full-sized avatar
Extremely busy...

Henry Wang HenryQW

Extremely busy...
View GitHub Profile
@HenryQW
HenryQW / client_activity.go
Created November 20, 2023 23:57
client_activity.go
func (c *client) FindActivities(ctx context.Context, query model.ActivitiesQuery) ([]*model.Activity, error) {
indexesQuery := model.IndexesQuery{
Distinct: query.Distinct,
Owner: query.Owner,
Limit: query.Limit,
Cursor: query.Cursor,
Status: query.Status,
Direction: query.Direction,
StartTimestamp: query.StartTimestamp,
EndTimestamp: query.EndTimestamp,
@HenryQW
HenryQW / brewski.sh
Created August 28, 2022 17:41
brew update on the fly, and also keeps Dock app states.
function brewski() {
defaults export com.apple.dock ~/dockstate
brew update && brew upgrade --greedy && brew upgrade --cask --greedy && brew cleanup
defaults import com.apple.dock ~/dockstate
killall Dock
rm ~/dockstate
}
@HenryQW
HenryQW / ssh-keyscan.sh
Last active April 6, 2018 12:45
ssh-keyscan
#!/bin/bash
if [ ! "${1}" ]
then
echo "Usage : ${0} TARGET_HOST"
exit 1
fi
TARGET_HOST="${1}"
@HenryQW
HenryQW / docker-compose.yml
Created March 4, 2018 17:42
docker-compose for postgres+ttrss
# For https://sspai.com/post/42787
version: "3"
services:
postgres:
container_name: postgres
image: sameersbn/postgresql:latest
ports:
- 5432:5432
network_mode: "bridge"
environment:
@HenryQW
HenryQW / purge_feed.sql
Last active February 9, 2018 12:04
Purge ttrss old feeds in postgres
delete
from
ttrss_entries
where
id in(
select
id
from
ttrss_entries
inner join ttrss_user_entries on
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@HenryQW
HenryQW / color-conversion-algorithms.js
Last active August 16, 2017 11:58 — forked from mjackson/color-conversion-algorithms.js
RGB, HSV, and HSL color conversion algorithms in JavaScript
/**
* Converts an RGB color value to HSL. Conversion formula
* adapted from http://en.wikipedia.org/wiki/HSL_color_space.
* Assumes r, g, and b are contained in the set [0, 255] and
* returns h, s, and l in the set [0, 1].
*
* @param Number r The red color value
* @param Number g The green color value
* @param Number b The blue color value
* @return Array The HSL representation