Skip to content

Instantly share code, notes, and snippets.

View naartjie's full-sized avatar

Marcin Jekot naartjie

View GitHub Profile
#r "nuget: FsHttp, 9.1.2"
open FsHttp
open System
let getSize url =
async {
let! r =
http {
HEAD url
(* lang = F# *)
seq { 1 .. 100 }
|> Seq.map (function
| x when x % 3 = 0 && x % 5 = 0 -> "CracklePop"
| x when x % 3 = 0 -> "Crackle"
| x when x % 5 = 0 -> "Pop"
| x -> x.ToString())
|> Seq.iter (printfn "%s")
open System
open System.Text.RegularExpressions
type Expr =
| Int of int
| Symbol of string
| Exprs of Expr list
(* convert a string into a list of tokens (include parentheses, remove whitespace) *)
let tokenize (str: string) =
(**
Pushes data from MongoDB to Oracle Micros iCare
Run it like so:
$ MONGO_URL=xxx \
MICROS_URL=xxx \
MICROS_USERNAME=xxx \
MICROS_PASSWORD=xxx \
dotnet fsi ./push_to_micros.fsx
*)
@naartjie
naartjie / debian_backports.sh
Last active October 13, 2021 10:28
Linux apt magic
# stretch
$ echo "deb http://deb.debian.org/debian stretch-backports main" >> /etc/apt/sources.list
$ apt install -t stretch-backports git
@naartjie
naartjie / wget.sh
Created January 1, 2021 16: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.
@naartjie
naartjie / App.fs
Created November 29, 2020 23:13
F# MongoDB Starter
open MongoDB.Driver
open MongoDB.Bson
open MongoDB.Driver.Linq
let doMongoStuff () =
let client = MongoClient("mongodb://localhost:27017")
let db = client.GetDatabase("rebujito-test")
let collectionName = "users"
@naartjie
naartjie / nmap.sh
Created November 18, 2020 08:45
Scan your local network
nmap -v -sn 192.168.1.0/24
# CAUTION: deletes all files not under git
git clean -xfd
@naartjie
naartjie / download a dependency.md
Last active October 6, 2020 19:57
Maven(-sucks)

Download a dependency

mvn dependency:get \
  -Dartifact=org.springframework.cloud.stream.app:mongodb-sink-kafka-10:1.3.1.RELEASE:jar \
  -Dtransitive=false \
  -Ddest=gfy.jar

This way you can "force" Nexus to download a dependency from upstream, for example.