Skip to content

Instantly share code, notes, and snippets.

View leopku's full-sized avatar

Song Liu leopku

View GitHub Profile
@leopku
leopku / gen_posters.sh
Created February 8, 2023 15:16
gen_posters.sh
#!/bin/bash
########################################################################
# gen_posters.sh - generate posters for plex video libraries
########################################################################
#
# Grabs a frame from a video file and creates a scaled, cropped
# poster file in the same directory
# Creates poster file in 2:3 aspect ratio
# Works on mkv, mp4 and avi
#
@leopku
leopku / ffmpeg.md
Created January 10, 2023 00:28 — forked from steven2358/ffmpeg.md
FFmpeg cheat sheet
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@leopku
leopku / cheatsheet-elasticsearch.md
Created August 30, 2021 09:42 — forked from ruanbekker/cheatsheet-elasticsearch.md
Elasticsearch Cheatsheet : Example API usage of using Elasticsearch with curl
func WithLimit(limit int) func(*Server) {
return func(s *Server) {
return s.setLimit(limit)
}
}
func NewServer(addr string, options ...func(*Server)) (*Server, error) {
l, err := net.Listen("tcp", addr)
if err != nil {
return nil, err
@leopku
leopku / deep_null_check.java
Last active September 16, 2019 12:42
Check a deep nest object properties in an elegant(Functional Programming) way.
Optional.ofNullable(product).map(
Product::getLatestVersion
).map(
ProductVersion::getProductData
).map(
ProductData::getTradeItem
).map(
TradeItemType::getInformationProviderOfTradeItem
).map(
PartyInRoleType::getGln
@leopku
leopku / dynamic_struct.go
Created September 5, 2019 11:09
Dynamic create struct in golang
package main
import (
"fmt"
)
type Creator func() Plugin
type Plugin interface {
Pr()
@leopku
leopku / cloud-torrent.json
Created August 27, 2019 04:21
config file for cloud-torrent
{
"eztv": {
"name": "EZTV",
"url": "https://eztv.ag/search/{{query}}",
"list": "table tr.forum_header_border",
"result": {
"name": "td:nth-child(2) a",
"url": ["td:nth-child(2) a", "@href"],
"magnet": ["td:nth-child(3) a:nth-child(1)", "@href"],
"size": "td:nth-child(4)",
@leopku
leopku / Makefile
Created July 3, 2018 14:25
how to build a go program with git revision
BUILD = `git rev-parse HEAD`
LDFLAGS=-ldflags "-X 'main.schema=$(SCHEMA)' -X 'main.build=$(BUILD)'"
build:
go build -a $(LDFLAGS) -o ./build/server ./cmd/server
@leopku
leopku / background-job.sh
Created May 12, 2018 08:38
run job background with screen
screen -d -m /bin/bash 'name-of-executable > logfile.out 2>&1'