Skip to content

Instantly share code, notes, and snippets.

@Tydus
Tydus / howto-standalone-toolchain.md
Last active May 4, 2023 13:43
How to install Standalone toolchain for Android

HOWTO Cross compiling on Android

5W1H

What is NDK

NDK (Native Develop Toolkit) is a toolchain from Android official, originally for users who writes native C/C++ code as JNI library. It's not designed for compiling standalone programs (./a.out) and not compatible with automake/cmake etc.

What is Standalone Toolchain

"Standalone" refers to two meanings:

  1. The program is standalone (has nothing connect to NDK, and don't need helper scripts to run it)
  2. The toolchain is made for building standalone programs and libs, and which can used by automake etc.

(Optional) Why NDK is hard to use

By default, NDK uses android flavor directory structure when it's finding headers and libs, which is different from GNU flavor, so the compiler cannot find them. For Example:

@ararog
ararog / MsgPackConverter.java
Created October 23, 2014 14:55
MessagePack converter for retrofit
package br.eti.faces.retrofit.converter;
import org.msgpack.MessagePack;
import org.msgpack.packer.Packer;
import org.msgpack.unpacker.Unpacker;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.lang.reflect.Type;
@pcan
pcan / SelfExpiringHashMap.java
Last active July 4, 2024 23:51
SelfExpiringHashMap - a Java Map which entries expire automatically after a given time; it uses a DelayQueue internally.
/*
* Copyright (c) 2019 Pierantonio Cangianiello
*
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@thoroc
thoroc / question1.md
Last active October 20, 2020 16:47
Skyscanner HackerRank questions - Oct 2015 - Backend Developer

Find the Most Popular Destination:

Your task is to find the most popular holiday destination from a list of destinations searched for by users. You are given as standard input the integer size of the list, followed by the names of the destinations themselves. The input has the following format:

  • on the first line, the count of items in the list
  • on the subsequent lines, the name of each destination searched for, one per line (each destination is a single word with no spaces, destinations can be searched for and appear more than once) The input is correct. There is at least one destination in the input. Write a program that reads the input from stdin and then outputs out the name of the most searched for destination i.e. the destination that appears most in the list. One destination is guaranteed to be the outright winner in the input.
@juliandescottes
juliandescottes / gist:169f3a57e1441542565b
Last active April 26, 2024 23:01
Devtools file loading
╔═════════════════════════════════════════════════════════════════════════════════╗
║ How to load/import a file in Firefox Devtools ? ║
╚═════════════════════════════════════════════════════════════════════════════════╝
╔════════════════════════╗
║ SYNC FILE LOADING ║
╚════════════════════════╝
┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┌───────────────────────────────┐
@endolith
endolith / overlaps.py
Last active October 7, 2021 23:23
Window function constant overlap-add conditions (COLA)
from __future__ import division, print_function, absolute_import
import numpy as np
import scipy
from spectral import check_COLA # https://github.com/scipy/scipy/pull/6058
windows = np.unique(scipy.signal.windows._win_equiv.values())
windows = sorted(windows, key=lambda x: x.__name__)
for window in windows:
try:
@random-robbie
random-robbie / BBC.m3u
Last active July 19, 2024 19:53
BBC HLS Streams - let me know if i missed any
#EXTM3U
#EXTINF:-1 tvg-id="BBC One HD" tvg-name="BBC One HD" tvg-logo="https://s4.postimg.org/k5xl5dmf1/bbc_one.png" group-title="BBC",BBC One HD
http://a.files.bbci.co.uk/media/live/manifesto/audio_video/simulcast/hls/uk/abr_hdtv/ak/bbc_one_hd.m3u8
#EXTINF:-1 tvg-id="BBC One London" tvg-name="BBC One London" tvg-logo="https://s4.postimg.org/z61nj8qd9/Bbc_london_logo.jpg" group-title="BBC",BBC One London
http://a.files.bbci.co.uk/media/live/manifesto/audio_video/simulcast/hls/uk/hls_tablet/ak/bbc_one_london.m3u8
#EXTINF:-1 tvg-id="BBC One Northern Ireland HD" tvg-name="BBC One Northern Ireland HD" tvg-logo="https://s3.postimg.org/ltztuojqr/6y_QROLCn_400x400.png" group-title="BBC",BBC One Northern Ireland HD
http://a.files.bbci.co.uk/media/live/manifesto/audio_video/simulcast/hls/uk/abr_hdtv/ak/bbc_one_northern_ireland_hd.m3u8
#EXTINF:-1 tvg-id="BBC One Scotland HD" tvg-name="BBC One Scotland HD" tvg-logo="https://s3.postimg.org/ltztuojqr/6y_QROLCn_400x400.png" group-title="BBC",BBC One Scotland HD
http://a.fi
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active July 23, 2024 06:43
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@acaly
acaly / reciprocal_fib.py
Last active December 9, 2023 18:24
A fast (but hard-to-read) implementation of Reciprocal fibonacci constant calculator in python. This was a UofT CSC373 assignment.
import array
import sys
import cProfile
# input
OutputCount = int(sys.argv[1])
# object init
@dzcpy
dzcpy / 超大字符集字体.md
Last active May 31, 2024 08:09
常用超大字符集字体

unicodecjkfonts

所谓“超大字符集字体”是指至少支持CJK-B的字体(约7万+字),常用的有如下几种:

中国大陆字形

  • 中易宋体(Windows 10 version 1809):部分支持CJK-E
13a81e63aae736ca2254492dd111d3ace4e9dbe9 *simsun.ttc
91a6e66e7c1139a27b6caa313dc451af36e4e5ed *simsunb.ttf