Skip to content

Instantly share code, notes, and snippets.

View mrsinguyen's full-sized avatar
🎯
Focusing

Si Nguyen mrsinguyen

🎯
Focusing
View GitHub Profile
@mrsinguyen
mrsinguyen / local-storage-size.js
Created March 24, 2017 07:08 — forked from cdmckay/local-storage-size.js
Detects the size of the browser's localStorage
if (localStorage && !localStorage.getItem('size')) {
var i = 0;
try {
// Test up to 10 MB
for (i = 250; i <= 10000; i += 250) {
localStorage.setItem('test', new Array((i * 1024) + 1).join('a'));
}
} catch (e) {
localStorage.removeItem('test');
localStorage.setItem('size', i - 250);
@mrsinguyen
mrsinguyen / Web Components Resources.md
Created March 21, 2017 12:47 — forked from ebidel/Web Components Resources.md
List of resources related to Web Components
@mrsinguyen
mrsinguyen / recover_source_code.md
Created March 12, 2017 09:51 — forked from simonw/recover_source_code.md
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb

Keybase proof

I hereby claim:

  • I am mrsinguyen on github.
  • I am mrsinguyen (https://keybase.io/mrsinguyen) on keybase.
  • I have a public key whose fingerprint is C2F0 9D58 7B6D 812D 4180 123C 93D7 7A73 4AC3 A1AE

To claim this, I am signing this object:

@mrsinguyen
mrsinguyen / root.sh
Created October 27, 2016 04:53 — forked from Arinerron/root.sh
"Root" via dirtyc0w privilege escalation exploit (automation script) / Android (32 bit)
#!/bin/bash
# Give the usual warning.
clear;
echo "[INFO] Automated Android root script started.\n\n[WARN] Exploit requires sdk module \"NDK\".\nFor more information, visit the installation guide @ https://goo.gl/E2nmLF\n[INFO] Press Ctrl+C to stop the script if you need to install the NDK module. Waiting 10 seconds...";
sleep 10;
clear;
# Download and extract exploit files.
echo "[INFO] Downloading exploit files from GitHub...";
@mrsinguyen
mrsinguyen / README.txt
Created September 28, 2016 08:40 — forked from cruppstahl/README.txt
upscaledb-mysql 0.0.1: initial benchmarks
These files were used to create the benchmarks for the release of upscaledb-mysql 0.0.1.
=== sysbench
Use sysbench 1.0. The shell script loads and runs the tests.
I ran various tests - with and without transactions, with LOCK TABLE etc. Results are in sysbench-results.txt.
=== uqi1
This script performs a `SELECT COUNT(*) FROM table`. The table was from TPC-C order_line with 6 million rows.
@mrsinguyen
mrsinguyen / GitlabContainerRegistrySetup.md
Created September 22, 2016 04:42 — forked from solidnerd/GitlabContainerRegistrySetup.md
GitLab Container Registry Setup

Settting up a Container Registry with docker-gitlab

This should be used for new users to getting started with the container registry feature on docker-gitlab.

Requirements

@mrsinguyen
mrsinguyen / gist.md
Created September 15, 2016 03:01 — forked from honza/gist.md
Clojure vs Haskell

Haskell vs Clojure

The JSON data is in the following format

{
    "Genesis": {
        "1": {
            "1": "In the beginning..." ,
            "2": "..."
@mrsinguyen
mrsinguyen / PhpJava.java
Created September 1, 2016 03:37 — forked from avafloww/PhpJava.java
This snippet of code is syntactically valid in both PHP and Java, and produces the same output in both.
/*<?php
//*/public class PhpJava { public static void main(String[] args) { System.out.printf("/*%s",
//\u000A\u002F\u002A
class PhpJava {
function main() {
echo(//\u000A\u002A\u002F
"Hello World!");
}}
//\u000A\u002F\u002A
PhpJava::main();
@mrsinguyen
mrsinguyen / graph_gist_template.adoc
Created August 11, 2016 09:51 — forked from jexp/graph_gist_template.adoc
CHANGEME: GraphGist Template. Fork to make your own, view source to see instruction comments

REPLACEME: TITLE OF YOUR GRAPHGIST

Introduction