Skip to content

Instantly share code, notes, and snippets.

View sytranvn's full-sized avatar
(n)

Sy Tran Dung sytranvn

(n)
View GitHub Profile
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocksConfig version="1">
<editor>
<colour_sets>
<ACTIVE_COLOUR_SET>
<str>
<![CDATA[modnokai night shift v2]]>
</str>
</ACTIVE_COLOUR_SET>
<ACTIVE_LANG>
@sytranvn
sytranvn / __git_ps1.md
Last active December 9, 2019 14:17
Bash PS1 with git
PS1='${debian_chroot:+($debian_chroot)}\[\033[0;32m\]\[\033[0m\033[0;32m\]\u\[\033[0;36m\]@\[\033[0;36m\]\h:\w\[\033[0;32m\]$(__git_ps1)\n\[\033[0;32m\]└─\[\033[0m\033[0;32m\] \$ \[\033[0m\] '

Screenshot from 2019-12-09 21-07-03

export GIT_PS1_SHOWDIRTYSTATE=true
export GIT_PS1_SHOWUNTRACKEDFILES=true
export GIT_PS1_SHOWUPSTREAM="auto"
@sytranvn
sytranvn / readme.md
Created June 11, 2019 08:48 — forked from pohmelie/readme.md
Install opencv3 for python 3.5.0 with pyenv on ubuntu 14.04

Install opencv3 for python 3.5.0 with pyenv on ubuntu 14.04

  • update cmake and install deps as this said.

  • run cmake

    cmake -D CMAKE_BUILD_TYPE=RELEASE \
    -D CMAKE_INSTALL_PREFIX=~/.pyenv/versions/3.5.0/usr/local/ \
    -D INSTALL_C_EXAMPLES=OFF \
    -D BUILD_NEW_PYTHON_SUPPORT=ON \
    
@sytranvn
sytranvn / isync.sh
Created February 19, 2019 07:22
sync home folder
#!/usr/bin/env bash
cd "$(dirname "${BASH_SOURCE}")";
# git pull origin master;
function doIt() {
rsync --exclude ".git/" \
--exclude ".DS_Store" \
--exclude ".osx" \
@sytranvn
sytranvn / execute.js
Created July 16, 2018 05:03 — forked from harrypujols/execute.js
Execute shell command in javascript
#!/usr/bin/env node
function execute(command) {
const exec = require('child_process').exec
exec(command, (err, stdout, stderr) => {
process.stdout.write(stdout)
})
}
@import 'styles/variables.css';
@import 'styles/colors.css';
.container {
composes: container from 'styles/lib/Commons.css';
padding: 0;
form {
padding: 0 $base-spacing;
}
}
@sytranvn
sytranvn / qs-parse.js
Created April 20, 2018 03:53
Parse query string to defined type
import _ from 'lodash';
import qs from 'qs';
const parseFromObject = (queryObj, propParsers) => {
if (typeof queryObj !== 'object') return {};
return [..._.keys(queryObj), ..._.keys(propParsers)].reduce(
(r, k) => (propParsers[k] && typeof propParsers[k] === 'function'
? { ...r, [k]: propParsers[k](queryObj[k]) }
: { ...r, [k]: queryObj[k] }),
{});
@sytranvn
sytranvn / ie-detect.js
Created April 20, 2018 03:52
Detect IE 11
export function isIE11() {
return !!window.MSInputMethodContext && !!document.documentMode;
}
@sytranvn
sytranvn / event.js
Created April 20, 2018 03:51
Dispatch an event that works on Android
export function dispatchNewEvent(eventName, target) {
let event;
try {
event = new Event(eventName, {
bubbles: true,
});
} catch (e) {
event = document.createEvent('Event');
event.initEvent(eventName, true, false);
}
@sytranvn
sytranvn / subTest
Created March 19, 2018 04:39 — forked from encukou/subTest
Python 3.4. subTest example
This is a comment on http://eli.thegreenplace.net/2014/04/02/dynamically-generating-python-test-cases/