Skip to content

Instantly share code, notes, and snippets.

View Khang-NT's full-sized avatar

Nguyễn Triết Khang Khang-NT

View GitHub Profile
@AmreeshTyagi
AmreeshTyagi / workbench-ui-fix.sh
Last active April 20, 2024 19:05
Exclude MySQL Workbench from dark theme with mojave Mac dark theme
#!/bin/bash
defaults write com.oracle.workbench.MySQLWorkbench NSRequiresAquaSystemAppearance -bool yes
echo "Successfully patched!"
echo "Now restart MySQL Workbench to see the Workbench in light theme."
#Restart MySQL Workbench after executing this.
@hungps
hungps / okhttp3.WebviewCookieHandler.java
Last active January 6, 2024 11:39
Cookie jar that handles syncing okhttp cookies with Webview cookie manager
import android.webkit.CookieManager;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import okhttp3.Cookie;
import okhttp3.CookieJar;
import okhttp3.HttpUrl;
@AgentOak
AgentOak / youtube_formats.md
Last active May 22, 2024 15:34
Youtube Format IDs

Last updated: April 2021

Also known as itag or format codes and way back they could be specified with the fmt parameter (e.g. &fmt=22). Depending on the age and/or popularity of the video, not all formats will be available.

DASH video

Resolution AV1 HFR High AV1 HFR AV1 VP9.2 HDR HFR VP9 HFR VP9 H.264 HFR H.264
MP4 MP4 MP4 WebM WebM WebM MP4 MP4
@yodeah
yodeah / gist:e33730290017af3a3f19cf1867f0e1a9
Last active March 23, 2023 06:53
Nginx https load balancer with lets encrypt cert

Nginx https load balancer with lets encrypt cert

Part 1: Create a working http load balancer

I'v decided to use amazon for hosting my (Ubuntu 14.04 trusty) server (t2.nano (still an overkill, anything with 256 mb ram is sufficient IMHO))

  1. you have to create a security profile which opens port 22 for ssh, 80 for http, and 443 for https.

  2. ssh into your server.

@alphamu
alphamu / AbstractParcelDiskCache.java
Last active May 2, 2019 18:04 — forked from VladSumtsov/DiskCache
Encrypted persisted and cached Parcelable data disklrucache and facebook conceal on Android.
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
import com.facebook.android.crypto.keychain.SharedPrefsBackedKeyChain;
import com.facebook.crypto.Crypto;
@VladSumtsov
VladSumtsov / DiskCache
Last active February 29, 2020 19:39
Cache your data with parcelable and disklrucache
import java.util.List;
public interface DiskCache<T> {
/**
* Sets the value to {@code value}.
*/
public void set(String key, T value);
/**
@martindale
martindale / parseTitleString.js
Last active September 25, 2020 01:33
Parse a string, such as a YouTube video title, for artist and track information.
// TODO: provide an array of potential separators
// var SEPARATORS = [' - ', ' – ', ' -- ']
// note that these can have spaces, but sometimes do not
// TODO: output a testing dataset for changes to this function.
var TRACK_SEPARATOR = ' - ';
function parseTitleString(string, partsCallback) {
var artist, title, credits = [];
var string = string || '';