Skip to content

Instantly share code, notes, and snippets.

💭
I may be slow to respond.

Huy Tr. huytd

💭
I may be slow to respond.
Block or report user

Report or block huytd

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@huytd
huytd / k2pdfopt-params
Created Aug 20, 2019
k2pdfopt param for iPhone X
View k2pdfopt-params
k2pdfopt -om 0.15 -w 800 -h 1732 <file-name>
@huytd
huytd / .gitconfig
Created Aug 4, 2016
Use neovim as diff tool
View .gitconfig
[merge]
tool = vimdiff
[mergetool]
prompt = true
[mergetool "vimdiff"]
cmd = nvim -d $LOCAL $REMOTE $MERGED -c '$wincmd w' -c 'wincmd J'
[difftool]
prompt = false
[diff]
tool = vimdiff
@huytd
huytd / d3-text-measure.js
Created May 6, 2016
Measure text size in pixels with D3.js
View d3-text-measure.js
function textSize(text) {
if (!d3) return;
var container = d3.select('body').append('svg');
container.append('text').attr({ x: -99999, y: -99999 }).text(text);
var size = container.node().getBBox();
container.remove();
return { width: size.width, height: size.height };
}
// Usage: textSize("This is a very long text");
View customize.material-dark-theme.md

;; Automatically generated
(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(anzu-cons-mode-line-p nil)
@huytd
huytd / android_game.java
Last active Aug 12, 2019
Simple game engine using Canvas for Android - using for quick prototype or simple games
View android_game.java
package com.gamarist.momoney;
import android.os.Bundle;
import android.R.integer;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Canvas;
@huytd
huytd / vscode-espresso-custom.json
Created Jul 14, 2019
vscode-espresso-custom.json
View vscode-espresso-custom.json
"workbench.colorCustomizations": {
"sideBar.background": "#fafafa",
"activityBar.background": "#fafafa",
"statusBar.background": "#fafafa",
"tab.inactiveBackground": "#fafafa",
"tab.border": "#fafafa",
"editorGroupHeader.tabsBackground": "#fafafa",
"editorLineNumber.foreground": "#dddddd",
"editorCursor.foreground": "#6ab04c",
"diffEditor.removedTextBackground": "#F8E5E1",
View .tmux.conf
set -g default-terminal "xterm-256color"
set-option -ga terminal-overrides ",xterm-256color:Tc"
set -g prefix C-x
unbind-key C-x
bind-key C-2 send-prefix
bind \ split-window -h -c '#{pane_current_path}'
bind / split-window -v -c '#{pane_current_path}'
# Copy-paste integration
@huytd
huytd / emacs.init.el
Last active Apr 17, 2019
Emacs config with no Evil
View emacs.init.el
;; Package configs
(require 'package)
(setq package-enable-at-startup nil)
(setq package-archives '(("org" . "http://orgmode.org/elpa/")
("gnu" . "http://elpa.gnu.org/packages/")
("melpa" . "https://melpa.org/packages/")))
(package-initialize)
;; Bootstrap `use-package`
(unless (package-installed-p 'use-package)
@huytd
huytd / slack-arc-dark.css
Created Apr 17, 2019
Arc dark theme for Slack, with Threads screen fix
View slack-arc-dark.css
body { background: #404552; color: #d3dae3; }
a { color: #90939b; }
a:link, a:visited { color: #90939b; }
a:hover, a:active, a:focus { color: #90939b; }
hr { border-bottom: 1px solid #454c5c; border-top: 1px solid #404552; }
h1, h2, h3, h4 { color: #d3dae3; }
h1 a { color: #d3dae3; }
h1 a:active, h1 a:hover, h1 a:link, h1 a:visited { color: #d3dae3; }
.bordered { border: 1px solid #2a2f39; }
.top_border { border-top: 1px solid #2a2f39; }
@huytd
huytd / ripgrep-in-emacs.md
Created Nov 16, 2018 — forked from pesterhazy/ripgrep-in-emacs.md
Using ripgrep in Emacs using helm-ag (Spacemacs)
View ripgrep-in-emacs.md

Why

Ripgrep is a fast search tool like grep. It's mostly a drop-in replacement for ag, also know as the Silver Searcher.

helm-ag is a fantastic package for Emacs that allows you to display search results in a buffer. You can also jump to locations of matches. Despite the name, helm-ag works with ripgrep (rg) as well as with ag.

How

You can’t perform that action at this time.