start new:
tmux
start new with session name:
tmux new -s myname
| import -window root -quality 98 /tmp/screenshot.png | |
| xclip -i < /tmp/screenshot.png | |
| rm /tmp/screenshot.png |
| 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. |
| ;; | |
| ;; 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. |
| (use 'clojure.pprint) | |
| (import 'java.lang.Thread) | |
| (-> (Thread/currentThread) (.getContextClassLoader) (.getURLs) (seq) (pprint)) |
| (println (clojure.string/join "\n" (seq (.getURLs (java.lang.ClassLoader/getSystemClassLoader))))) |
| //Version 2.6 | |
| (function () { | |
| function eOPML(str) { | |
| return str | |
| .replace(/&/g, '&amp;') | |
| .replace(/</g, '&lt;') | |
| .replace(/>/g, '&gt;') | |
| .replace(/"/g, '"') | |
| .replace(/(\n)/g, ' '); | |
| } |
| # 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 |
| #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 |