Skip to content

Instantly share code, notes, and snippets.

View hthuong09's full-sized avatar

Thuong (Tyson) Nguyen hthuong09

View GitHub Profile
@hthuong09
hthuong09 / archinstall.sh
Created August 18, 2016 03:10
Arch Install with EFI and Grub2
# These command was inspired from helmuthdu/aui
# BASIC INSTALLATION
# Select Keymap
loadkeys us
# Select Editor
pacman -S vim nano
# Configure Mirrorlist
/*
* robotMaze.js
*
* The blue key is inside a labyrinth, and extracting
* it will not be easy.
*
* It's a good thing that you're a AI expert, or
* we would have to leave empty-handed.
*/
@hthuong09
hthuong09 / gist:7e10957df5bdd5ef2e354aa5334c4e42
Created April 28, 2016 06:00 — forked from gleuch/gist:2475825
Javascript documentfragment to string (w/ text selection)
// selection range
var range = window.getSelection().getRangeAt(0);
// plain text of selected range (if you want it w/o html)
var text = window.getSelection();
// document fragment with html for selection
var fragment = range.cloneContents();
// make new element, insert document fragment, then get innerHTML!
@hthuong09
hthuong09 / recursiveDLMF.py
Created February 2, 2016 03:57
Recursively get download link mediafire folder
from mediafire import MediaFireApi
import humanfriendly
import sys
import wget
api = MediaFireApi()
#folder_key = sys.argv[1]
folder_key = 'oct0x6rwhtkks';
@hthuong09
hthuong09 / model.php
Created December 10, 2015 03:11
Global scope eloquent
<?php
class Comment extends Eloquent {
public function newQuery()
{
return parent::newQuery()->where('cat', '=', 6);
}
// Now when you will perform a query like :
@hthuong09
hthuong09 / inject jquery.js
Created October 15, 2015 06:57
inject jquery to any webpage
function addJQuery(callback) {
var script = document.createElement("script");
script.setAttribute("src", "//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js");
script.addEventListener('load', function() {
var script = document.createElement("script");
script.textContent = "window.jQ=jQuery.noConflict(true);(" + callback.toString() + ")();";
document.body.appendChild(script);
}, false);
document.body.appendChild(script);
}
@hthuong09
hthuong09 / youtubetv.css
Created October 13, 2015 04:28
Youtube TV on Chrome Fullscreen
@-moz-document url-prefix("https://www.youtube.com/tv") {
.html5-video-player .video-stream {
width: 100%;
height: 100%;
}
}
@hthuong09
hthuong09 / share-online.biz.php
Created June 23, 2015 19:28
share-online.biz file size encryption algorithm
<?php
function encrypt($original) {
$arr = range(0, strlen($original) - 1);
shuffle($arr);
$shuffleStr = '';
$hexStr = '';
foreach ($arr as $char) {
$shuffleStr .= $original[$char];
$hexStr .= str_pad(dechex($char), 3, "0", STR_PAD_LEFT);
}