Skip to content

Instantly share code, notes, and snippets.

@ruanyf
ruanyf / mtr.css
Created March 16, 2019 11:23
mtr.css: Hong Kong MTR station colors http://metrocolor.live/index.html
:root {
--heng-fa-chuen: #b51921;
--tai-koo: #b2103e;
--kowloon-bay: #c41832;
--tseung-kwan-o: #ef342a;
--wui-kai-sha: #a84d18;
--po-lam: #f68f26;
--sai-wan-ho: #faca07;
--disneyland-resort: #07594a;
--skek-kip-mei: #4ba946;
@gombru
gombru / FocalLoss.py
Last active August 5, 2024 20:28
Caffe Python layer Focal Loss implementation (From Focal Loss for Dense Object Detection, Facebook paper)
import caffe
import numpy as np
import json
class FocalLoss(caffe.Layer):
"""
Compute Focal Loss
Inspired by https://arxiv.org/abs/1708.02002
Raul Gomez Bruballa
https://gombru.github.io/
@adamczykm
adamczykm / list-dirs-recursively.el
Created September 12, 2017 00:29
List subdirectories recursively in emacs lisp (elisp),
(defun list-dirs-recursively (dir &optional include-symlinks)
"Return list of all subdirectories recursively. Returns absolute paths.
Optionally call recursively on symlinks."
(let ((result nil)
(tramp-mode (and tramp-mode (file-remote-p (expand-file-name dir)))))
(dolist (file (file-name-all-completions "" dir))
(when (and (directory-name-p file) (not (member file '("./" "../"))))
(setq result (nconc result (list (expand-file-name file dir))))
(let* ((leaf (substring file 0 (1- (length file))))
(full-file (expand-file-name leaf dir)))
@to-bee
to-bee / tensorflow-gpu-sierra
Last active January 11, 2021 01:24
Build tensorflow with gpu support on OSX Sierra
disable sip in recovery mode
start recovery mode with Cmd + R on startup
start terminal
csrutil disable
download and install cuda 8
download cuDNN v6.0 for cuda 8 (register first)
install xcode 7.2
current xcode version is not supported
@agzam
agzam / all ex commands.org
Last active September 14, 2022 14:36
All ex commands
e[dit]evil-edit
w[rite]evil-write
wa[ll]evil-write-all
sav[eas]evil-save
r[ead]evil-read
b[uffer]evil-buffer
bn[ext]evil-next-buffer
bp[revious]evil-prev-buffer
bN[ext]bprevious
sb[uffer]evil-split-buffer

Build tensorflow on OSX with NVIDIA CUDA support (GPU acceleration)

These instructions are based on Mistobaan's gist but expanded and updated to work with the latest tensorflow OSX CUDA PR.

Requirements

OS X 10.10 (Yosemite) or newer

@squarism
squarism / iterm2.md
Last active March 22, 2026 00:10
An iTerm2 Cheatsheet

In the below keyboard shortcuts, I use the capital letters for reading clarity but this does not imply shift, if shift is needed, I will say shift. So + D does not mean hold shift. + Shift + D does of course.

Tabs and Windows

Function Shortcut
New Tab + T
Close Tab or Window + W (same as many mac apps)
Go to Tab + Number Key (ie: ⌘2 is 2nd tab)
Go to Split Pane by Direction + Option + Arrow Key
@m00nlight
m00nlight / gist:daa6786cc503fde12a77
Last active April 26, 2025 15:50
Python KMP algorithm
class KMP:
def partial(self, pattern):
""" Calculate partial match table: String -> [Int]"""
ret = [0]
for i in range(1, len(pattern)):
j = ret[i - 1]
while j > 0 and pattern[j] != pattern[i]:
j = ret[j - 1]
ret.append(j + 1 if pattern[j] == pattern[i] else j)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@v5tech
v5tech / ffmpeg.md
Last active October 14, 2024 19:57
ffmpeg视频合并、格式转换、截图

使用ffmpeg合并MP4文件

ffmpeg -i "Apache Sqoop Tutorial Part 1.mp4" -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate1.ts
ffmpeg -i "Apache Sqoop Tutorial Part 2.mp4" -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate2.ts
ffmpeg -i "Apache Sqoop Tutorial Part 3.mp4" -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate3.ts
ffmpeg -i "Apache Sqoop Tutorial Part 4.mp4" -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate4.ts
ffmpeg -i "concat:intermediate1.ts|intermediate2.ts|intermediate3.ts|intermediate4.ts" -c copy -bsf:a aac_adtstoasc "Apache Sqoop Tutorial.mp4"