Skip to content

Instantly share code, notes, and snippets.

Avatar

Stanley Zheng stanzheng

View GitHub Profile
@stanzheng
stanzheng / wget.sh
Created Nov 30, 2022 — forked from crittermike/wget.sh
Download an entire website with wget, along with assets.
View wget.sh
# One liner
wget --recursive --page-requisites --adjust-extension --span-hosts --convert-links --restrict-file-names=windows --domains yoursite.com --no-parent yoursite.com
# Explained
wget \
--recursive \ # Download the whole site.
--page-requisites \ # Get all assets/elements (CSS/JS/images).
--adjust-extension \ # Save files with .html on the end.
--span-hosts \ # Include necessary assets from offsite as well.
--convert-links \ # Update links to still work in the static version.
@stanzheng
stanzheng / wget.sh
Created Nov 30, 2022 — forked from crittermike/wget.sh
Download an entire website with wget, along with assets.
View wget.sh
# One liner
wget --recursive --page-requisites --adjust-extension --span-hosts --convert-links --restrict-file-names=windows --domains yoursite.com --no-parent yoursite.com
# Explained
wget \
--recursive \ # Download the whole site.
--page-requisites \ # Get all assets/elements (CSS/JS/images).
--adjust-extension \ # Save files with .html on the end.
--span-hosts \ # Include necessary assets from offsite as well.
--convert-links \ # Update links to still work in the static version.
@stanzheng
stanzheng / Caddyfile
Created May 22, 2022 — forked from nileshtrivedi/Caddyfile
Caddy on fly.io as reverse proxy to services on Tailscale network
View Caddyfile
log stdout
errors stdout
auto_https off
http://myapp.fly.dev {
reverse_proxy 100.120.108.62:8000
}
@stanzheng
stanzheng / Caddyfile
Created May 22, 2022 — forked from nileshtrivedi/Caddyfile
Caddy on fly.io as reverse proxy to services on Tailscale network
View Caddyfile
log stdout
errors stdout
auto_https off
http://myapp.fly.dev {
reverse_proxy 100.120.108.62:8000
}
View CreditCardNumberGenerator.java
import java.util.Random;
/**
* A credit card number generator.
*
* @author Josef Galea
*/
public class CreditCardNumberGenerator {
private Random random = new Random(System.currentTimeMillis());
@stanzheng
stanzheng / main.c
Created May 13, 2020 — forked from ColorfulCodes/main.c
This is the mt3620 blinky
View main.c
#include <stdbool.h>
#include <errno.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <applibs/storage.h>
#include <applibs/log.h>
#include <applibs/gpio.h>
@stanzheng
stanzheng / nginx.conf
Created Mar 13, 2017 — forked from dctrwatson/nginx.conf
Caching NPM proxy using Nginx
View nginx.conf
user www-data;
worker_processes 4;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
@stanzheng
stanzheng / hb_all_books_dl.js
Last active Aug 19, 2018 — forked from graymouser/hb_all_books_dl.js
Humble bundle book bundles - download all books at once
View hb_all_books_dl.js
/*
After purchasing a humble book bundle, go to your download page for that bundle.
Open a console window for the page and paste in the below javascript
Updated: Credit @jmerle
*/
const commands = [];
document.querySelectorAll('.row').forEach(row => {
const bookTitle = row.dataset.humanName;
View rabbitasyncawait.js
var amqp = require('amqplib')
var open = require('amqplib').connect('amqp://localhost');
const connect = (url = 'amqp://localhost') => {
return new Promise((resolve, reject) => {
amqp.connect(url)
.then(conn => resolve(conn))
.catch(err => reject(err))
})
View magic.js
class Magic {
constructor(fn, a) {
this.__chain = [[fn, a]];
}
get(t, a) {
if (a == "✨✨MAGIC✨✨") return true;
if (a == "resolve") {
return () => Magic.chain(this.__chain);
}
return (...b) => {