Skip to content

Instantly share code, notes, and snippets.

View BigCatAccount's full-sized avatar
😺

Max P. BigCatAccount

😺
View GitHub Profile
import org.scalatest.FlatSpec
class ScalaTestExampleSpec extends FlatSpec {
trait Builder {
val builder = new StringBuilder("ScalaTest is ")
}
"Testing" should "be productive" in new Builder {
builder.append("productive!")
@BigCatAccount
BigCatAccount / curl.md
Created October 1, 2016 04:41 — forked from btoone/curl.md
A curl tutorial using GitHub's API

Introduction

An introduction to curl using GitHub's API

The Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin
@BigCatAccount
BigCatAccount / git-branches-by-commit-date.sh
Created January 5, 2017 15:06 — forked from jasonrudolph/git-branches-by-commit-date.sh
List remote Git branches and the last commit date for each branch. Sort by most recent commit date.
# Credit http://stackoverflow.com/a/2514279
for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ci %cr" $branch | head -n 1` \\t$branch; done | sort -r
We can make this file beautiful and searchable if this error is corrected: Illegal quoting in line 2.
id;title;description;google_product_category;link;image_link;condition;custom_label_1;custom_label_2;custom_label_3;custom_label_4;availability;price;brand;gtin;mpn;identifier_exists;gender;material;age_group;color;size;shipping(country:service:price);sale_price
111;" - Dylan blau in 30/34 | ARMEDANGELS";Bio Dylan blau für Herren aus 100% Baumwolle (bio) in 30/34. Faire Kleidung produziert aus nachhaltigen Materialien, vegan und GOTS zertifiziert.;1604;https://www.armedangels.de/dylan-451290.html#415=3343?redirection=no;;new;No;Spring Summer 2018;40;1;in stock;99.90EUR;ARMEDANGELS;4,25E+12;1,03E+13;TRUE;Herren;;adult;blau;30/34;DE:DHL:4.95 EUR;0
222;Chino aus Bio-Baumwolle Mix - Brandon grün in 30/32 | ARMEDANGELS;Bio Chino aus Bio-Baumwolle Mix Brandon grün für Herren aus 100% Baumwolle (bio) in 30/32. Faire Kleidung produziert aus nachhaltigen Materialien, vegan und GOTS zertifiziert.;1604;https://www.armedangels.de/maennerbekleidung-hose-chino-solid-brandon-10251597-256.html#411=3268?redirecti
@BigCatAccount
BigCatAccount / linq.scala
Created August 7, 2019 03:31 — forked from SteveBate/linq.scala
Scala LINQ equivalents
// http://stackoverflow.com/questions/8104846/chart-of-ienumerable-linq-equivalents-in-scala
xs.Aggregate(accumFunc) -> xs.reduceLeft(accumFunc)
xs.Aggregate(seed, accumFunc) -> xs.foldLeft(seed)(accumFunc)
xs.Aggregate(seed, accumFunc, trans) -> trans(xs.foldLeft(seed)(accumFunc))
xs.All(pred) -> xs.forall(pred)
xs.Any() -> xs.nonEmpty
xs.Any(pred) -> xs.exists(pred)
xs.AsEnumerable() -> xs.asTraversable // roughly
xs.Average() -> xs.sum / xs.length
#!/bin/bash
set -u
# Clones and softlinks a git repo, _if needed_.
# Summary of steps:
# 1. Checks that the provided repo is valid (SSH or HTTP)
# 2. Compares local and remote commit to see if there is a new version
# 3. Clones the remote commit in local, adding -<timestamp>-<commit> to the folder name
# 4. Deletes .git directory of the cloned repo
@BigCatAccount
BigCatAccount / realfeel.py
Created September 4, 2021 17:10 — forked from mumblepins/realfeel.py
Accuweather Realfeel temperature calculator
# Based on patent https://www.google.com/patents/US7251579
# Not responsible if you use this for anything other than personal use
from math import sqrt
def realfeel(W, #windspeed mph
A, #pressure mb
T, # temperature F
UV, # UV Index
D, # Dew Point F
P2, # preciptation Factor from 0-5

ELF Format Cheatsheet

Introduction

Executable and Linkable Format (ELF), is the default binary format on Linux-based systems.

ELF

Compilation

@BigCatAccount
BigCatAccount / Every possible TypeScript type.md
Created June 22, 2022 04:27 — forked from laughinghan/Every possible TypeScript type.md
Diagram of every possible TypeScript type

Hasse diagram of every possible TypeScript type

  • any: magic, ill-behaved type that acts like a combination of never (the proper [bottom type]) and unknown (the proper [top type])
    • Anything except never is assignable to any, and any is assignable to anything at all.
    • Identities: any & AnyTypeExpression = any, any | AnyTypeExpression = any
    • Key TypeScript feature that allows for [gradual typing].
  • unknown: proper, well-behaved [top type]
    • Anything at all is assignable to unknown. unknown is only assignable to itself (unknown) and any.
    • Identities: unknown & AnyTypeExpression = AnyTypeExpression, unknown | AnyTypeExpression = unknown
  • Prefer over any whenever possible. Anywhere in well-typed code you're tempted to use any, you probably want unknown.
@BigCatAccount
BigCatAccount / Cont.scala
Created February 23, 2023 12:42 — forked from kmizu/Cont.scala
A naive continuation monad implementation in Scala. It is useless. However, it maybe useful to understand continuation monad.
//This implementation is a porting of naive continuation monad in Haskell in "All About Monads" pages.
class Cont[R, +A](val runCont: (A => R) => R) {
def map[B](f: A => B): Cont[R, B] = {
new Cont[R, B](k => runCont(a => Cont.ret[R, B](f(a)).runCont(k)))
}
def flatMap[B](f: A => Cont[R, B]) :Cont[R, B] = {
new Cont[R, B](k => runCont(a => f(a).runCont(k)))
}
}