Skip to content

Instantly share code, notes, and snippets.

View agaro1121's full-sized avatar

Anthony Garo agaro1121

View GitHub Profile
@agaro1121
agaro1121 / nvim_macros.md
Last active October 21, 2023 00:44
Nvim Macros to multiple files
  1. Create macro (let's say we're saving it to 'x')
  2. View macros in registry :reg x
  3. Copy content of macro "xp
  4. Store macro to file (file must be loaded by vim on startup. See here

Use "[register letter]p to paste into a file with the format below

let @x = "<macro contents>"
  1. Use find to generate a list of files that need to be updated ie find . -type f -name "*.yaml"
@agaro1121
agaro1121 / alacritty-tmux-vim_truecolor.md
Created October 20, 2022 03:05 — forked from andersevenrud/alacritty-tmux-vim_truecolor.md
True Color (24-bit) and italics with alacritty + tmux + vim (neovim)

True Color (24-bit) and italics with alacritty + tmux + vim (neovim)

This should make True Color (24-bit) and italics work in your tmux session and vim/neovim when using Alacritty (and should be compatible with any other terminal emulator, including Kitty).

Testing colors

Running this script should look the same in tmux as without.

curl -s https://gist.githubusercontent.com/lifepillar/09a44b8cf0f9397465614e622979107f/raw/24-bit-color.sh >24-bit-color.sh
@agaro1121
agaro1121 / F_Algebra.scala
Created April 1, 2021 14:24 — forked from MiloXia/F_Algebra.scala
F-algebra & F-coalgebra in Scala
import scala.language.higherKinds
import scalaz._, Scalaz._
object F_Algebra {
//### F-Algebra
//Fixed point of type constructor
case class Fix[F[_]](f: F[Fix[F]])
type Algebra[F[_], A] = Function[F[A], A] //a morphism from F(A) to A
@agaro1121
agaro1121 / predef.scala
Created November 5, 2019 22:44 — forked from mpilquist/predef.scala
Ammonite REPL predef for use with fs2
// Save as ~/.ammonite/predef.sc
// To use fs2 from ammonite repl, type `load.fs2` from repl prompt.
// You'll get all fs2 & cats imports, ContextShift and Timer instances
// for IO, and a globalBlocker
import $plugin.$ivy.`org.typelevel:::kind-projector:0.11.0`
if (!repl.compiler.settings.isScala213)
repl.load.apply("interp.configureCompiler(_.settings.YpartialUnification.value = true)")
@agaro1121
agaro1121 / autoplugin.md
Created September 1, 2019 15:47
[Scala]: Remove console noise
package console

import sbt._

/** [[FixScalacOptionsInConsole]] is an [[AutoPlugin]] that removes
  * noisy or unnecessary scalac options when running an sbt console.
  */
object FixScalacOptionsInConsole extends AutoPlugin {
@agaro1121
agaro1121 / spark.md
Created August 1, 2019 20:35
Spark Notes
import org.apache.spark.sql.DataFrame
import org.apache.spark.sql.types.StructField
import org.apache.spark.sql.functions._

/**
 Spark doesn't allow you to join dataframes with different schemas.
 This will figure out the missing fields and tack them on to the 
 separate dataframes and join everything together into 1 union
*/
@agaro1121
agaro1121 / futres.md
Created July 26, 2019 15:23
Future Run semantics
def bar(f: => Future[Any]): Future[Any] = {Thread.sleep(1000); f}

bar(Future(blah)) // runs the future when `f` is reached in bar, 1 second after the call is made.

val foo = Future(blah) // future starts now
bar(foo)

def bar(f: => Future[Unit]): Future[Unit] = {f; f}
@agaro1121
agaro1121 / ulimit.md
Created November 25, 2018 20:09
mac_cli

sudo launchctl limit maxfiles 1000000 1000000

@agaro1121
agaro1121 / logback_disable_in_unit_tests.md
Created October 29, 2018 16:11 — forked from traviskaufman/logback_disable_in_unit_tests.md
Logback: Disable all logging in unit tests

After scouring the internet and piece-mealing together the correct way to do this, here is a step-by-step, all-in-one-place guide to making logback STFU when running your unit tests.

Here's how to do it

Save the following as logback-test.xml under src/test/resources:

<configuration>
  <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
    <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
      <pattern>%msg%n</pattern>
@agaro1121
agaro1121 / app.js
Created October 7, 2018 22:49 — forked from camshaft/app.js
Superagent circuit breaker
/**
* Module dependencies
*/
var request = require("superagent")
, breaker = require("./breaker");
// Add the circuit breaker to the default middleware
request.middleware.push(breaker(3000));
// ...snip...