Skip to content

Instantly share code, notes, and snippets.

:octocat:
from 🇻🇳

Thanh Tran trongthanh

:octocat:
from 🇻🇳
Block or report user

Report or block trongthanh

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
@trongthanh
trongthanh / marco-compton.conf
Last active Mar 20, 2019 — forked from vemacs/compton.conf
Sensible marco-compton.conf for Ubuntu MATE 18.10 (and fix shadow at Ulauncher search panel)
View marco-compton.conf
# For Ubuntu MATE, save this config file at ~/.config/marco-compton.conf
#################################
#
# Backend
#
#################################
# Backend to use: "xrender" or "glx".
# GLX backend is typically much faster but depends on a sane driver.
@trongthanh
trongthanh / pygment-ocean.css
Created Jan 8, 2019
Ocean theme for Pygment / Rouge syntax highlighter
View pygment-ocean.css
// stylelint-disable
.highlight pre { color:#cdd3de; background-color: #142026; }
.highlight .hll { background-color: #142026; }
.highlight .c { color: #65737e; font-style: italic; } /* Comment */
.highlight .err { color: #ec5f67; background-color: #1e0010 } /* Error */
.highlight .k { color: #c594c5 } /* Keyword */
.highlight .l { color: #f99157 } /* Literal */
.highlight .n { color: #f07178 } /* Name */
.highlight .o { color: #5fb3b3 } /* Operator */
.highlight .p { color: #6699cc } /* Punctuation */
@trongthanh
trongthanh / hook-fns.js
Last active Nov 1, 2018 — forked from getify/1.js
experiment: mimicking React's new "useState()" hook for stand-alone functions.
View hook-fns.js
/**
* Note: I have forked this gist from @getify to rewrite it with variable naming with closer association with hook and state
* and added some comments of my own so that it is easier to follow
* A demo is live at: https://codepen.io/trongthanh/pen/WaqqoJ?editors=0012
*/
'use strict';
[foo, bar] = enableHooks(foo, bar);
function foo(origX, origY) {
@trongthanh
trongthanh / apply-pantheon-terminal-color.sh
Created Oct 18, 2018
Apply custom color theme for Pantheon Terminal ver 5.3+
View apply-pantheon-terminal-color.sh
#!/bin/bash
# Apply custom color theme for Pantheon Terminal ver 5.3+
# 1) preview and choose a color theme from http://mayccoll.github.io/Gogh/
# 2) open the equivalent bash file containing the color values at https://github.com/Mayccoll/Gogh/tree/master/themes
# 3) concatenate all 16 colors at the top with colon ":", then replace it at the palette variable below
# 4) replace color for foreground, background, and cursor; choose whether your theme is light or dark
# 5) sudo apt-get install dconf-tools
# 6) execute this script
@trongthanh
trongthanh / index.html
Created Oct 13, 2018
jquery-handlebars-boilerplate
View index.html
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>MY PAGE TITLE HERE</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.0.4/handlebars.js"></script>
<script>
$(function() {
View tizonia_aliases.sh
# Tizonia aliases
alias ti="tizonia"
function tis() {
echo "Shortcuts for tizonia --spotify-*"
echo "tistr arg Search and play from Spotify by track name."
echo "tisar arg Search and play from Spotify by artist name."
echo "tisal arg Search and play from Spotify by album name."
echo "tispl arg Search and play public playlists (owner is assumed current user, unless --spotify-owner is provided)."
echo "tisop ow pl Search and play public playlist by an owner"
@trongthanh
trongthanh / mojave.xml
Last active Nov 28, 2019
macOS Mojave dynamic background re-implement as GTK+ background slideshow. Background images are changed to reflect the time of the day.
View mojave.xml
<!-- Instructions:
- Download and unzip Mojave dynamic background here: https://files.rb.gd/mojave_dynamic.zip
- Rename the extracted folder as "mojave-background" (Excuse the trouble but I renamed it on my machine and already use that path in the XML file)
- Save this xml file next to the Mojave background files
- Fix the path to the background images below (better using absolute path)
- Lastly, either:
+ GNOME: Use gnome-tweaks tool to select this XML as wallpaper (as default wallpaper settings won't let you choose wallpaper from custom path)
+ MATE: Go to background setting (in Appearance) > Choose +Add... > make sure **All files** filter is selected at the bottom right > Then choose mojave.xml
-->
<background>
@trongthanh
trongthanh / init-goalify-chat-server.sh
Created Mar 5, 2018
Goalify Chat server instance init
View init-goalify-chat-server.sh
#!/bin/bash
# NOTE: The commands here only applicable for Ubuntu 16.04 Xenial, do not use it for other distros
# Get user inputs for some customizable variables
# NOTE: map domain to this VPS instance first
read -p "Domain: " DOMAIN
# Update server to latest packages
sudo apt update && sudo apt upgrade -y
@trongthanh
trongthanh / index.js
Last active Jul 11, 2017
Read a News table (exported from MS SQL Server in Unicode format) and convert to static HTML pages
View index.js
/**
* (c) 2017 Thanh Tran
*
* Node script to convert a SQL Server table of News article to a static HTML site (for archive purpose)
*
* The SQL Server management tool extract the table to flat text file with below specs:
* - Row delimiters: {CR} \r
* - Col delimiters: {|} vertical bars
* - Unicode encoding (UTF-16)
* By Windows OS nature, HTML content in Contents column has new lines with CRLF sequence.
View init.coffee
# initialization file (not found)
You can’t perform that action at this time.