Skip to content

Instantly share code, notes, and snippets.

View davidepedranz's full-sized avatar

Davide Pedranz davidepedranz

View GitHub Profile
@btroncone
btroncone / rxjs_operators_by_example.md
Last active July 16, 2023 14:57
RxJS 5 Operators By Example
@btroncone
btroncone / ngrxintro.md
Last active February 9, 2024 15:37
A Comprehensive Introduction to @ngrx/store - Companion to Egghead.io Series

Comprehensive Introduction to @ngrx/store

By: @BTroncone

Also check out my lesson @ngrx/store in 10 minutes on egghead.io!

Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!

Table of Contents

@orlando
orlando / mac-setup.md
Last active May 13, 2024 17:39 — forked from todc/mac-setup.md
Fresh Mac OS Setup

1. Run Software Update

Make sure everything is up to date in the App Store

2. Install Homebrew

  1. Open a terminal window and execute the Homebrew install script:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
@dnorton
dnorton / example_unit_test.kt
Created March 15, 2016 14:29
simple unit test example in Kotlin
import org.junit.Test
import org.assertj.core.api.Assertions
import org.junit.BeforeClass
class ThingTest {
companion object {
@JvmStatic
@BeforeClass fun init() {
@epcim
epcim / brew_install_coreutils.sh
Created November 13, 2015 10:47
OSX brew install GNU coreutils, bin utils etc...
# From https://www.topbug.net/blog/2013/04/14/install-and-use-gnu-command-line-tools-in-mac-os-x/
export PATH="$(brew --prefix coreutils)/libexec/gnubin:/usr/local/bin:$PATH"
brew install coreutils
brew install gnu-tar --with-default-names
# alternatively
brew install binutils
brew install diffutils
@owainlewis
owainlewis / Application.scala
Last active September 19, 2018 09:16
Play framework HTTP token based authentication
package controllers.api
import play.api.mvc.{ Controller, Action }
import models._
import dao._
object Discussion extends Controller with TokenAuthentication {
def index = withAPIToken { user => { request =>
Ok(Json.toJson(DiscussionDAO.all))
@noelwelsh
noelwelsh / Example.scala
Created February 20, 2015 16:06
Robust Error Handling in Scala
import scalaz.\/
import scalaz.syntax.either._
object Example2 {
// This example simulates error handling for a simple three tier web application
//
// The tiers are:
// - the HTTP service
// - a user authentication layer
// - a database layer
@denji
denji / golang-tls.md
Last active May 29, 2024 10:16 — forked from spikebike/client.go
Simple Golang HTTPS/TLS Examples

Moved to git repository: https://github.com/denji/golang-tls

Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
@praseodym
praseodym / AESGCMUpdateAAD2.java
Last active May 13, 2024 10:20
JDK8 AES-GCM code example
import javax.crypto.*;
import javax.crypto.spec.GCMParameterSpec;
import java.nio.ByteBuffer;
import java.security.SecureRandom;
import java.util.Arrays;
public class AESGCMUpdateAAD2 {
// AES-GCM parameters
public static final int AES_KEY_SIZE = 128; // in bits
@lalyos
lalyos / README.md
Last active February 28, 2023 03:38
proxy docker /var/run/docker.sock to port 2375 with socat

The new Docker daemon uses port: 2376 with TLS enable by default. Sometimes I want to play with curl on the old plain http port 2375. The trick is: use socat in a container to proxy the unix socket to a real port.

docker run -d \
  --volume /var/run/docker.sock:/var/run/docker.sock \
  --name docker-http \
  deb socat -d -d TCP-L:2375,fork UNIX:/var/run/docker.sock