Skip to content

Instantly share code, notes, and snippets.

@ankuagar
ankuagar / README.md
Created April 27, 2022 00:49 — forked from joyrexus/README.md
golang web examples
@ankuagar
ankuagar / gist:0834dfd216676b8ed6476ad499c69a40
Created March 22, 2022 00:22 — forked from aodin/gist:9493190
Parsing JSON in a request body with Go
package main
import (
"encoding/json"
"io/ioutil"
"log"
"net/http"
)
type Message struct {
@ankuagar
ankuagar / wget.sh
Created October 18, 2021 01:10 — forked from crittermike/wget.sh
Download an entire website with wget, along with assets.
# 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.
@ankuagar
ankuagar / Makefile
Created August 26, 2021 01:05 — forked from mpneuried/Makefile
Simple Makefile to build, run, tag and publish a docker containier to AWS-ECR
# import config.
# You can change the default config with `make cnf="config_special.env" build`
cnf ?= config.env
include $(cnf)
export $(shell sed 's/=.*//' $(cnf))
# import deploy config
# You can change the default deploy config with `make cnf="deploy_special.env" release`
dpl ?= deploy.env
include $(dpl)
From: http://www.labnol.org/software/wget-command-examples/28750/
How do I download an entire website for offline viewing? How do I save all the MP3s from a website to a folder on my computer? How do I download files that are behind a login page? How do I build a mini-version of Google?
Wget is a free utility – available for Mac, Windows and Linux (included) – that can help you accomplish all this and more. What makes it different from most download managers is that wget can follow the HTML links on a web page and recursively download the files. It is the same tool that a soldier had used to download thousands of secret documents from the US army’s Intranet that were later published on the Wikileaks website.
You mirror an entire website with wget
Mirror an entire website with wget
Spider Websites with Wget – 20 Practical Examples
@ankuagar
ankuagar / fetchbasic.sh
Last active October 31, 2020 01:00 — forked from bgeesaman/fetchbasic.sh
Obtain GKE Basic Auth Credentials and use them
#!/usr/bin/env bash
CLUSTER_NAME="basicauth"
LOCATION="--zone us-central1-a"
#LOCATION="--region us-central1"
# Get cluster metadata
echo -n "Fetching cluster metadata..."
CLUSTER="$(gcloud container clusters describe ${CLUSTER_NAME} ${LOCATION} --format=json)"
echo "done."
@ankuagar
ankuagar / kubernetes-cheatsheet.md
Created April 21, 2020 21:10 — forked from jonashackt/kubernetes-cheatsheet.md
Kubernetes cheat sheet
@ankuagar
ankuagar / curl.md
Created September 29, 2019 17:46 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

Here's the prime sieve of eratosthenes implemented in 4 different functional languages.

Which one's your favorite?

OCaml
let rec range s e = if s > e then [] else s :: range (s + 1) e;;

let countprimes n =
  let rec aux count = function

Here's the prime sieve of eratosthenes implemented in 4 different functional languages.

Which one's your favorite?

OCaml
let rec range s e = if s > e then [] else s :: range (s + 1) e;;

let countprimes n =
  let rec aux count = function