Skip to content

Instantly share code, notes, and snippets.

@jiaoyk
jiaoyk / last_day_of_month.go
Created September 30, 2024 07:12 — forked from hosszukalman/last_day_of_month.go
Get the last day of the actual month in Golang
package main
import (
"fmt"
"time"
)
func main() {
now := time.Now()
@jiaoyk
jiaoyk / command.txt
Created August 9, 2024 11:12 — forked from nrk/command.txt
Using ffprobe to get info from a file in a nice JSON format
ffprobe -v quiet -print_format json -show_format -show_streams "lolwut.mp4" > "lolwut.mp4.json"
@jiaoyk
jiaoyk / unicode_normalization.md
Created July 25, 2024 06:24 — forked from ciscorn/unicode_normalization.md
Normalizing Unicode strings in Python / Go / Rust

Normalizing Unicode strings in Python / Go / Rust

NFC, NFD, NFKC, NFKD

input:

it’säå(1−2)ドブロク㍿

result:

@jiaoyk
jiaoyk / parallels-reset.sh
Created May 3, 2023 04:21 — forked from gdurastanti/parallels-reset.sh
Reset Parallels' trial
#!/bin/sh
# Reset Parallels Desktop's trial and generate a casual email address to register a new user
rm /private/var/root/Library/Preferences/com.parallels.desktop.plist /Library/Preferences/Parallels/licenses.xml
jot -w pdu%[email protected] -r 1
@jiaoyk
jiaoyk / .bash_profile
Created May 2, 2023 14:38 — forked from jonsuh/.bash_profile
Bash echo in color
# ----------------------------------
# Colors
# ----------------------------------
NOCOLOR='\033[0m'
RED='\033[0;31m'
GREEN='\033[0;32m'
ORANGE='\033[0;33m'
BLUE='\033[0;34m'
PURPLE='\033[0;35m'
CYAN='\033[0;36m'
@jiaoyk
jiaoyk / ordering.cpp
Created April 30, 2023 05:23 — forked from adah1972/ordering.cpp
Intel CPU reordering example made to work on macOS
// Jeff Preshing's example that shows the reordering of Intel CPUs made to
// work on both Linux and macOS.
//
// Original source:
//
// https://preshing.com/20120515/memory-reordering-caught-in-the-act/
//
// Apple semaphore change is based on the answer by dho at:
//
// https://stackoverflow.com/questions/27736618/why-are-sem-init-sem-getvalue-sem-destroy-deprecated-on-mac-os-x-and-w
@jiaoyk
jiaoyk / .gitignore
Created April 30, 2023 01:20 — forked from hghwng/.gitignore
SciTools Understand for Arch Linux
pkg/
src/
understand-bin-*.pkg.*
Understand-*.tgz
.SRCINFO
@jiaoyk
jiaoyk / gist:682266e8aa85d77403029a75f95d4716
Created January 19, 2023 08:59 — forked from vmsmith/gist:ff511036e9abba7c3385
Streaming Algorithms and Data Structures
1. *General Background and Overview*
* [Probabilistic Data Structures for Web Analytics and Data Mining](http://highlyscalable.wordpress.com/2012/05/01/probabilistic-structures-web-analytics-data-mining/) : A great overview of the space of probabilistic data structures and how they are used in approximation algorithm implementation.
* [Models and Issues in Data Stream Systems](http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.106.9846)
* [Philippe Flajolet’s contribution to streaming algorithms](https://speakerdeck.com/timonk/philippe-flajolets-contribution-to-streaming-algorithms) : A presentation by Jérémie Lumbroso that visits some of the hostorical perspectives and how it all began with Flajolet
* [Approximate Frequency Counts over Data Streams](http://www.vldb.org/conf/2002/S10P03.pdf) by Gurmeet Singh Manku & Rajeev Motwani : One of the early papers on the subject.
* [Methods for Finding Frequent Items in Data Streams](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.187.9800&rep
@jiaoyk
jiaoyk / geo.rb
Created January 13, 2023 12:25 — forked from gilles/geo.rb
Some geo functions for Ruby (haversine) and a mixin for spherical search in Mongo (tested with mongoid)
# geo.rb
# Formulas from
#
# haversine formula to compute the great circle distance between two points given their latitude and longitudes
#
# Copyright (C) 2008, 360VL, Inc
# Copyright (C) 2008, Landon Cox
#
# http://www.esawdust.com (Landon Cox)