Skip to content

Instantly share code, notes, and snippets.

View linktohack's full-sized avatar

Quang-Linh LE linktohack

View GitHub Profile
@linktohack
linktohack / magasin.js
Created December 29, 2016 16:41
Barcode generator
var blocks = magasins.map(m => {
var block = $(`
<div class="block" style="display: inline-block; border: 2px dotted grey; margin: 10px; border-radius: 5px;">
<p>${m.name}</p>
<img id=DB${m.pano} style="width: 200px">
</div>
`);
return block;
});
FROM resin/%%RESIN_MACHINE_NAME%%-node
ENV DEBIAN_FRONTEND noninteractive
# Instal MySQL Server
RUN echo mysql-server mysql-server/root_password password root | debconf-set-selections;\
echo mysql-server mysql-server/root_password_again password root | debconf-set-selections;
RUN apt-get update && apt-get install -yq mysql-server mysql-client libmysqlclient-dev
RUN sed -i -e "s@^datadir.*@datadir = /data/mysql@" /etc/mysql/my.cnf
@linktohack
linktohack / cask-outdated.sh
Created November 1, 2016 12:33
Oudated Cask (-q + grep to script)
function cask-outdated() {
local INFO
local OUTDATED
local LATEST
local c
local available
local installed
for c in $(brew cask list); do
INFO=$(cask info $c 2>&1)
@linktohack
linktohack / nfc.js
Last active February 6, 2017 15:01
NFC
var nfc = require('nfc').nfc;
var util = require('util');
var Badge = {
logging: true,
read: function(callback) {
var Badge = this;
var i = 0;
Badge.logging && console.log('nfc.version(): ' + util.inspect(nfc.version(), { depth: null }));
@linktohack
linktohack / index.php
Created June 20, 2016 07:20
Adminer 4.2.5 loader without password for SQLite
<?php
function adminer_object() {
class AdminerSoftware extends Adminer {
function login($login, $password) {
return true;
}
}
return new AdminerSoftware;
}
include "./adminer-4.2.5.php";
@linktohack
linktohack / real-click.js
Last active April 14, 2016 23:43
selenium real click via xdotool
var Promise = require('bluebird'),
child_process = require('child_process')
exec = Promise.promisify(child_process.exec);
realClick(driver, "document.querySelectorAll('.srg > div:nth-child(3) > div:nth-child(1) > h3:nth-child(1) > a:nth-child(1)')[0]");
function realClick(driver, element) {
return driver.executeScript("\
document.myNamespace = {};\
document.myNamespace.mousePositionHandler = function (e) {\
@linktohack
linktohack / metaview.py
Last active March 3, 2016 11:40
MITM rule for bigger screen
# Usage: mitmdump -s "modify_response_body.py mitmproxy bananas"
# (this script works best with --anticache)
from libmproxy.models import decoded
script = '''
<script type="text/javascript">
(function() {
var width = 400;
big();
@linktohack
linktohack / 6.el
Last active January 4, 2016 23:38
Regions - multiple selections
(provide 'regions)
(defvar regions nil
"Regions in buffer.")
(defun regions-maybe-push-selection ()
"Push mark and point if point is not in regions."
(let ((point (point))
exists)
(dolist (sel regions)
export EDITOR=vim
export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="nicoulaj"
plugins=(docker fasd fzf git helm history kubectl macos direnv mise)
source $ZSH/oh-my-zsh.sh
eval "$(atuin init zsh)"
export FZF_DEFAULT_OPTS="--bind ctrl-k:kill-line,ctrl-b:preview-page-up,ctrl-f:preview-page-down"
export _FASD_BACKENDS="native spotlight"
@linktohack
linktohack / lastpass.sh
Created September 29, 2015 15:50
Another password manager
function lastpass () {
url=""
username=""
password=""
function fill() {
pb=$(pbpaste)
osascript -e 'tell application "System Events" to keystroke tab using command down'
echo "$username" | pbcopy
osascript -e 'tell application "System Events" to keystroke "v" using command down'
osascript -e 'tell application "System Events" to keystroke tab'