Skip to content

Instantly share code, notes, and snippets.

@HaiNguyen007
HaiNguyen007 / get_gists.py
Created July 24, 2019 15:10 — forked from leoloobeek/get_gists.py
Download all gists for a specific user
# first: mkdir user && cd user && cp /path/to/get_gists.py .
# python3 get_gists.py user
import requests
import sys
from subprocess import call
user = sys.argv[1]
r = requests.get('https://api.github.com/users/{0}/gists'.format(user))
@HaiNguyen007
HaiNguyen007 / get_gists.py
Created July 24, 2019 15:10 — forked from epogrebnyak/get_gists.py
Download all gists for a specific user
"""Download all gists for a specific user in a local directory using git.
Make a directory for a <user> and copy this file there before running.
mkdir <user>
cd <user>
curl https://gist.githubusercontent.com/epogrebnyak/c14d6d2ca2740d1e1018e701ea00472a/raw/ec44560c8fd8fb92ca81bafa48b0a08272138104/get_gists.py > get_gists.py
python3 get_gists.py user
"""
@HaiNguyen007
HaiNguyen007 / hello.md
Last active July 24, 2019 15:31 — forked from jasonjoh/test.md
Hello World Markdown
@HaiNguyen007
HaiNguyen007 / pbedit.sh
Created July 21, 2019 13:15 — forked from TooTallNate/pbedit.sh
`pbedit` command: Edit the clipboard in your $EDITOR
# Edit the clipboard in your $EDITOR
# Add this to your `.bashrc` file
function pbedit () {
local tmpfile=`mktemp`
pbpaste > $tmpfile
$EDITOR $tmpfile
pbcopy < $tmpfile
rm -f $tmpmfile
}
export -f pbedit
@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;');
}