Skip to content

Instantly share code, notes, and snippets.

View qb20nh's full-sized avatar
💭
I may be slow to respond.

Yoo Taejong qb20nh

💭
I may be slow to respond.
  • 23:59 (UTC +09:00)
View GitHub Profile
@blutorange
blutorange / res_noun_2kanji.txt
Created April 1, 2015 17:31
Japanese homphpones and their relative frequencies
# number of different words with the same pronunciation (kana)
# entry_number kana averaged_number_of_different_words frequency_of_all_words number_of_different_words list-of-words
0 ショウネン 1.0000850412450037 11760 2 少年(11759) 正念(1)
1 ショウジョ 1.0001412030499859 21249 3 少女(21246) 陞叙(2) 昇叙(1)
2 キョウフ 1.0001717032967032 5825 2 恐怖(5824) 教父(1)
3 ヒツヨウ 1.000184026499816 16305 2 必要(16302) 必用(3)
4 シュウレイ 1.000230520977409 4339 2 秀麗(4338) 秋冷(1)
5 ホンキ 1.000278164116829 3596 2 本気(3595) 本木(1)
6 ソクド 1.0002824858757062 3541 2 速度(3540) 測度(1)
7 ツウシン 1.000337723741979 2962 2 通信(2961) 痛心(1)
@Michael0x2a
Michael0x2a / Logoff-Inactive.ps1
Last active May 10, 2024 03:50
Logoff-Inactive
<#
.SYNOPSIS
Logs out inactive users.
.DESCRIPTION
Logs out inactive users, except for specific users that
have been manually approved and are allowed to stay logged
in for indefinite periods of time.
You can run this script directly on Powershell:
@necmettin
necmettin / find-multiple-extensions.sh
Created August 14, 2015 18:48
Find files by extension, multiple extensions
find FOLDER -type f \( -iname \*.php -o -iname \*.twig \)
@ukoloff
ukoloff / cmdize.bat
Last active August 8, 2024 21:22
Wrap (almost) any language into batch file
:: USAGE
:: cmdize name [...]
::
:: This tool converts a supported code into a batch file that can be
:: executed without explicit invoking the executable engine. The script
:: creates new file and places it under the same directory as the original
:: one with the same name, replacing the original extension with ".bat".
:: The content of the new file consists of the original file and the
:: special header that being the "polyglot" and having some tricks to be a
:: valid code in batch file and the wrapped code at the same time.
@ppseprus
ppseprus / entropy-in-short.js
Last active August 22, 2024 10:13 — forked from jabney/entropy.js
Javascript implementation of a Shannon entropy calculation in bits per symbol
// Shannon entropy
const entropy = str => {
return [...new Set(str)]
.map(chr => {
return str.match(new RegExp(chr, 'g')).length;
})
.reduce((sum, frequency) => {
let p = frequency / str.length;
return sum + p * Math.log2(1 / p);
}, 0);
@jbboehr
jbboehr / ffmpeg-hevc-encode-nvenc.md
Created February 23, 2017 21:58
This gist shows you how to encode specifically to HEVC with ffmpeg's NVENC on supported hardware, with a two-pass profile and optional CUVID-based hardware-accelerated decoding.

Encoding high-quality HEVC content in a two-pass manner with FFmpeg - based NVENC encoder on supported hardware:

If you've built ffmpeg as instructed here on Linux and the ffmpeg binary is in your path, you can do fast HEVC encodes as shown below, using NVIDIA's NPP's libraries to vastly speed up the process.

Now, to do a simple NVENC encode in 1080p, (that will even work for Maxwell Gen 2 (GM200x) series), start with:

ffmpeg  -i <inputfile> -pass 1 \
-filter:v hwupload_cuda,scale_npp=w=1920:h=1080:format=nv12:interp_algo=lanczos,hwdownload,format=nv12 \

-c:v hevc_nvenc -profile main -preset slow -rc vbr_2pass \

@pierrejoubert73
pierrejoubert73 / markdown-details-collapsible.md
Last active November 5, 2025 16:18
How to add a collapsible section in markdown.

How to add a collapsible section in markdown

1. Example

Click me

Heading

  1. Foo
  2. Bar
    • Baz
  • Qux
@ateesdalejr
ateesdalejr / polyglot.bat
Created October 23, 2017 17:00
Bash and Batch polyglot. (Really nice for build scripts that need to support multiple platforms.)
echo off
echo ; set +v # > NUL
echo ; function GOTO { true; } # > NUL
GOTO WIN
# bash part, replace it to suit your needs
exit 0
:WIN
REM win part, replace it to suit your needs
@m3g4p0p
m3g4p0p / watch-your-back.js
Last active April 4, 2024 17:11
Capture a video stream and play it with some delay
const DELAY = 2000
const videos = []
const hide = el => el.style.display = 'none'
const show = el => el.style.display = 'block'
const showAndHideOthers = ({ target }) => {
window.requestAnimationFrame(() => {
videos.forEach(hide)
show(target)
@ph4r05
ph4r05 / ct_array_compare.java
Last active November 11, 2021 09:13
Constant time array equality check in java
package ct;
public class CT {
/**
* Constant time array equals check.
* If the lengths do not match the function returns false immediately.
* @param a array A
* @param b array B
* @return true if arrays are equal on defined intervals