Skip to content

Instantly share code, notes, and snippets.

View vejeta's full-sized avatar
🎯
Focusing

Juan Manuel Méndez Rey vejeta

🎯
Focusing
View GitHub Profile
#!/bin/zsh
# WARNING! The script is meant to show how and what can be disabled. Don’t use it as it is, adapt it to your needs.
# Credit: Original idea and script disable.sh by pwnsdx https://gist.github.com/pwnsdx/d87b034c4c0210b988040ad2f85a68d3
# Disabling unwanted services on macOS Big Sur (11), macOS Monterey (12), macOS Ventura (13) and macOS Sonoma (14)
# Disabling SIP is required ("csrutil disable" from Terminal in Recovery)
# Modifications are written in /private/var/db/com.apple.xpc.launchd/ disabled.plist, disabled.501.plist
# To revert, delete /private/var/db/com.apple.xpc.launchd/ disabled.plist and disabled.501.plist and reboot; sudo rm -r /private/var/db/com.apple.xpc.launchd/*
# user
@raulraja
raulraja / refinement.kt
Last active November 9, 2018 11:18
Type Refinement with Type Classes and ApplicativeError
package arrow.refined
import arrow.Kind
import arrow.core.*
import arrow.data.*
import arrow.effects.validated.positiveInt.plus
import arrow.effects.validated.positiveInt.positive
import arrow.extension
import arrow.instances.either.applicativeError.applicativeError
import arrow.instances.listk.traverse.traverse

Applied Functional Programming with Scala - Notes

Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x
@cb372
cb372 / jargon.md
Last active May 14, 2024 03:45
Category theory jargon cheat sheet

Category theory jargon cheat sheet

A primer/refresher on the category theory concepts that most commonly crop up in conversations about Scala or FP. (Because it's embarassing when I forget this stuff!)

I'll be assuming Scalaz imports in code samples, and some of the code may be pseudo-Scala.

Functor

A functor is something that supports map.

@lopezpdvn
lopezpdvn / install-fahclient-linux-systemd-service-unit.md
Last active January 14, 2023 07:21
Install Folding@home FAHClient on Linux as a systemd service unit

Install Folding@home FAHClient on Linux as a systemd service unit

Republished on my website, keeping this version here for historical reasons.

Install FAHClient as documented in the official guide. Stop the traditional init script service that was created and automatically started.

@javierfs89
javierfs89 / gist.scala
Created October 29, 2014 09:22
Sync Futures vs Async Futures
import scala.concurrent._
import scala.concurrent.duration._
import ExecutionContext.Implicits.global
object MyApp {
def processA(f: Int, b: Int, c: Int) = {
Thread.sleep(2000)
f + b + c
}
def processB(g: Int) = {
@jeffsteinmetz
jeffsteinmetz / gist:063bd3237033f3af2ed9
Last active October 20, 2023 22:20
Generate Unique, Hashed, Random Token in Scala for use in API calls or as an OAuth Token Bearer
import scala.util._
import java.security.SecureRandom
import java.security.MessageDigest
/*
* Generates a Bearer Token with a length of
* 32 characters (MD5) or 64 characters (SHA-256) according to the
* specification RFC6750 (http://tools.ietf.org/html/rfc6750)
*
* Uniqueness obtained by hashing system time combined with a
@jboner
jboner / how-akka-maps-to-eai-patterns.txt
Last active October 9, 2022 21:57
How Akka maps to EAI Patterns
# How Akka maps to EAI Patterns
Might be up for debate or just plain wrong. Just some notes I scribbled down some time ago.
-----------------------------------------------------------------------------------------------------------------
EAI PATTERN AKKA PATTERN REFERENCE
-----------------------------------------------------------------------------------------------------------------
Point to Point Channel Regular Actor Communication http://www.eaipatterns.com/PointToPointChannel.html
Event-Driven Consumer Regular Actor Receive http://www.eaipatterns.com/EventDrivenConsumer.html
Message Selector Actor with Stash http://www.eaipatterns.com/MessageSelector.html
@tyrcho
tyrcho / HTML.scala
Last active February 3, 2017 13:13
Processing HTML with Scala as if XML
import java.net.URL
import scala.xml.XML
import org.xml.sax.InputSource
import scala.xml.parsing.NoBindingFactoryAdapter
import org.ccil.cowan.tagsoup.jaxp.SAXFactoryImpl
import java.net.HttpURLConnection
import scala.xml.Node
object HTML {
lazy val adapter = new NoBindingFactoryAdapter