Skip to content

Instantly share code, notes, and snippets.

Avatar
⛑️

Huy huytd

⛑️
View GitHub Profile
@huytd
huytd / ffmpeg-compress-mp4
Created Dec 18, 2018 — forked from lukehedger/ffmpeg-compress-mp4
Compress mp4 using FFMPEG
View ffmpeg-compress-mp4
$ ffmpeg -i input.mp4 -vcodec h264 -acodec mp2 output.mp4
@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

@huytd
huytd / slim-redux.js
Created May 24, 2017 — forked from gaearon/slim-redux.js
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-)
View slim-redux.js
function mapValues(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
result[key] = fn(obj[key], key);
return result;
}, {});
}
function pick(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
if (fn(obj[key])) {
@huytd
huytd / x11-get-clipboard-text.cpp
Created Mar 30, 2017 — forked from t-mat/x11-get-clipboard-text.cpp
X11: クリップボードからUTF-8テキストを取得する
View x11-get-clipboard-text.cpp
// g++ -std=c++0x x11clipboard.cpp -lX11
// http://tools.suckless.org/sselp
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <string>
#include <climits>
std::string getClipboardText() {
std::string result;
Display* d = XOpenDisplay(nullptr);
@huytd
huytd / XClipboard.cpp
Created Mar 30, 2017 — forked from bluecube/XClipboard.cpp
Clipboard under X11
View XClipboard.cpp
#include "Agui/Clipboard/XClipboard.hpp"
#include <X11/Xatom.h>
#include <stdio.h>
#include <sys/select.h>
#include <unistd.h>
#include <assert.h>
#include <algorithm>
#include <iostream>
// Most of the code here is adapted from the example at
@huytd
huytd / x11keylogger.c
Last active Mar 30, 2017 — forked from robertklep/gist:5124355
X11 keylogger
View x11keylogger.c
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <netdb.h>
#include <string.h>
#include <netinet/in.h>
#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
@huytd
huytd / package.json
Created Sep 8, 2016 — forked from dghuy/package.json
Webpack Babel React SCSS PostCSS
View package.json
"dependencies": {
"autoprefixer": "^6.4.1",
"babel": "^6.5.2",
"babel-core": "^6.14.0",
"babel-loader": "^6.2.5",
"babel-preset-es2015": "^6.14.0",
"babel-preset-react": "^6.11.1",
"css-loader": "^0.25.0",
"node-sass": "^3.9.3",
"postcss-loader": "^0.13.0",
View secret_management_with_vault.md

Secret Management with Vault

Problems

  • Cloud deployment problem: Where do we store our secrets (read: database username and password) and how to give them to the server when we deploy?
  • Secret sharing and auditing problem: If everybody in our team uses the same token, how can we audit when something wrong happend? Who is the last person logged in using the shared key?
  • Revocation problem: our ex-sysadmin have quitted, how we managed to remove his
View lldb_cheat_sheet.md

LLDB Cheat Sheet

A complete gdb to lldb command map.

Print out

  • Print object
(lldb) po responseObject
(lldb) po [responseObject objectForKey@"state"]
  • p - Print primitive type
View index.html
<link href='http://fonts.googleapis.com/css?family=Open+Sans:700' rel='stylesheet' type='text/css'>
<a id="view-code" href="http://codepen.io/virgilpana/pen/wBOBYo" target="_blank">VIEW CODE</a>
<div id="window">
<div id="header">
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
</div>
You can’t perform that action at this time.