Skip to content

Instantly share code, notes, and snippets.

@handlerug
handlerug / telegram_emoji.js
Created August 20, 2020 11:30
JavaScript for using Apple emojis via Telegram CDN
// extracted https://translations.telegram.org/js/translations.js
function strEmojiToHex(emoji, trim_ef0f) {
var hex = encodeURIComponent(emoji).replace(/%([0-9a-f]{2})|(.)/gi, function(m, m1, m2){ return m1 || m2.charCodeAt(0).toString(16); }).toUpperCase();
if (trim_ef0f !== false) hex = hex.replace(/EFB88F/g, '');
return hex;
}
// then just insert the result into this URL
// https://telegram.org/img/emoji/{32|40}/{emojicode}.png
@handlerug
handlerug / emoji.js
Last active May 24, 2020 16:00
Convert raw emoji symbol to Apple emoji image URL from Rocketbank CDN
function getEmojiCode(emoji) {
return emoji
.split('')
.map((s, i) => emoji.codePointAt(i))
.filter((s) => s < 56320 || s > 57343)
.map((s) => s.toString(16).padStart(4, '0'))
.join('-')
.replace(/\-fe0f/g, '')
.replace(/\-200d$/, '');
}
@handlerug
handlerug / Book.Makefile
Created February 28, 2018 11:49
Book makefile
SCHEMES_DIR = schemes
SCHEMES_FZZ = $(shell find $(SCHEMES_DIR) -name "*.fzz")
#SCHEMES_BB = $(SCHEMES_FZZ:%.fzz=%_breadboard.png)
SCHEMES_SCH = $(SCHEMES_FZZ:%.fzz=%_schematic.png)
CHAPTERS = $(shell find chapters -name "*.tex")
# %_breadboard.svg %_schematic.svg: %.fzz
# fritzing -svg $(SCHEMES_DIR) $<
@handlerug
handlerug / Install Caffe.md
Last active July 4, 2020 05:16
Install Caffe with Makefile, cmake, and with OpenBLAS

Install Caffe with Makefile, cmake, and with OpenBLAS

Prerequisites

$ sudo apt install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler
$ sudo apt install --no-install-recommends libboost-all-dev
$ sudo apt install libatlas-base-dev libopenblas-dev
$ sudo apt install libgflags-dev libgoogle-glog-dev liblmdb-dev

Clone the repository: