Skip to content

Instantly share code, notes, and snippets.

import -window root -quality 98 /tmp/screenshot.png
xclip -i < /tmp/screenshot.png
rm /tmp/screenshot.png
@HaiNguyen007
HaiNguyen007 / scraper.js
Created July 19, 2019 11:42 — forked from veb/scraper.js
Scrapes the main page of HackerNews and returns an array of objects using Puppeteer and Cheerio
const puppeteer = require('puppeteer');
const cheerio = require('cheerio');
async function run() {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://news.ycombinator.com');
let content = await page.content();
var $ = cheerio.load(content);
; A REPL-based, annotated Seesaw tutorial
; Please visit https://github.com/daveray/seesaw for more info
;
; This is a very basic intro to Seesaw, a Clojure UI toolkit. It covers
; Seesaw's basic features and philosophy, but only scratches the surface
; of what's available. It only assumes knowledge of Clojure. No Swing or
; Java experience is needed.
;
; This material was first presented in a talk at @CraftsmanGuild in
; Ann Arbor, MI.
@HaiNguyen007
HaiNguyen007 / ns-cheatsheet.clj
Created March 30, 2019 08:18 — forked from ghoseb/ns-cheatsheet.clj
Clojure ns syntax cheat-sheet
;;
;; NS CHEATSHEET
;;
;; * :require makes functions available with a namespace prefix
;; and optionally can refer functions to the current ns.
;;
;; * :import refers Java classes to the current namespace.
;;
;; * :refer-clojure affects availability of built-in (clojure.core)
;; functions.
@HaiNguyen007
HaiNguyen007 / gist:795b5e0e92e6cf45b24749fe0c839144
Created March 30, 2019 08:10 — forked from ekoontz/gist:1502838
Show your classpath within Clojure REPL.
(use 'clojure.pprint)
(import 'java.lang.Thread)
(-> (Thread/currentThread) (.getContextClassLoader) (.getURLs) (seq) (pprint))
@HaiNguyen007
HaiNguyen007 / classpath.clj
Created March 30, 2019 08:10 — forked from bonkydog/classpath.clj
print the classpath from clojure
(println (clojure.string/join "\n" (seq (.getURLs (java.lang.ClassLoader/getSystemClassLoader)))))
@HaiNguyen007
HaiNguyen007 / ClipToWorkFlowyBookmarklet.js
Created March 29, 2019 15:32
Clip To WorkFlowy Bookmarklet
//Version 2.6
(function () {
function eOPML(str) {
return str
.replace(/&/g, '&amp;amp;')
.replace(/</g, '&amp;lt;')
.replace(/>/g, '&amp;gt;')
.replace(/"/g, '&quot;')
.replace(/(\n)/g, '&#10;');
}
@HaiNguyen007
HaiNguyen007 / run.sh
Created March 12, 2019 09:32 — forked from jakub300/run.sh
Compile headless shell (Chromium)
# Based on:
# http://www.zackarychapple.guru/chrome/2016/08/24/chrome-headless.html
# https://www.chromium.org/developers/how-tos/get-the-code
# https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md
apt-get update
apt-get install -y curl git htop man unzip vim wget python
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH=$PATH:`pwd`/depot_tools
mkdir Chromium && cd Chromium
@HaiNguyen007
HaiNguyen007 / tmux-cheatsheet.markdown
Created January 9, 2019 08:01 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
#Generate root password
import random, string
password = ''.join(random.choice(string.ascii_letters + string.digits) for i in range(20))
#Download ngrok
! wget -q -c -nc https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
! unzip -qq -n ngrok-stable-linux-amd64.zip
#Setup sshd
! apt-get install -qq -o=Dpkg::Use-Pty=0 openssh-server pwgen > /dev/null
#Set root password