Skip to content

Instantly share code, notes, and snippets.

@jmacias
jmacias / osx-setup.sh
Created December 25, 2020 01:45 — forked from dgraham/osx-setup.sh
A setup script for macOS development.
xcode-select --install
if [ ! -x /usr/local/bin/brew ]; then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
brew tap 'homebrew/cask'
brew tap 'homebrew/cask-fonts'
brew tap 'homebrew/bundle'
brew tap 'homebrew/core'
@jmacias
jmacias / Transform.scala
Created August 24, 2018 16:46 — forked from lloydmeta/Transform.scala
[Scala] Transforms one case class into another as long as the fields are a subset of the other via LabelledGeneric; Scastie link https://scastie.scala-lang.org/lloydmeta/ra0dvrV5Q2uxruQKoR020Q/2
@ import $ivy.{`com.chuusai::shapeless:2.3.3`}
import shapeless._, ops.hlist.Align, ops.hlist.SelectAll, SelectAll._
class Transform[T] {
// The fun stuff. Given an S, returns a T, if S has the right (subset of) fields
def apply[S, SR <: HList, TR <: HList](s: S)(
implicit
genS: LabelledGeneric.Aux[S, SR],

gif-from-tweet

There are so many great GIFs out there and I want to have copies of them. Twitter makes that harder than it should be by converting them to MP4 and not providing access to the source material. To make it easier, I made a bash pipeline that takes a tweet URL and a filename, extracts the MP4 from that tweet and uses ffmpeg to convert back to GIF.

Dependencies

  • ffmpeg
    • macOS: brew install ffmpeg
    • Ubuntu/Debian: apt install ffmpeg
@jmacias
jmacias / spark-avro-json-sample.py
Created February 1, 2018 20:52 — forked from itaysk/spark-avro-json-sample.py
How to process Event Hub Archive's files using Spark
from pyspark.sql import SparkSession
spark = SparkSession \
.builder \
.appName("spark-avro-json-sample") \
.config('spark.hadoop.avro.mapred.ignore.inputs.without.extension', 'false') \
.getOrCreate()
#storage->avro
avroDf = spark.read.format("com.databricks.spark.avro").load(in_path)
atom.commands.add 'atom-text-editor', 'repl:eval-selected-sexp-and-replace', ->
if editor = atom.workspace.getActiveTextEditor()
if selected = editor.getSelectedText()
protoRepl.executeCodeInNs(selected,
{resultHandler: (result) ->
console.log(result)
editor.insertText(result.value)})

Advanced Functional Programming with Scala - Notes

Copyright © 2016-2017 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

Code Splitting

NOTE: This gist uses the master branch of ClojureScript. Clone ClojureScript and from the checkout run ./script/bootstrap and ./script/uberjar. This will produce target/cljs.jar which you can use to follow this guide.

As client applications become larger it becomes desirable to load only the code actually required to run a particular logical screen. Previously ClojureScript :modules compiler option permitted such code splitting, but this feature only worked under :advanced compilation and users would still have to manage loading these splits. :modules also required manual

mov2gif(){
ffmpeg -i "$1" -vf scale=800:-1 -pix_fmt rgb24 -r 10 -f image2pipe -vcodec ppm - |\
convert -delay 10 -layers Optimize -loop 0 - "$2"
}

What I Wish I'd Known About Equity Before Joining A Unicorn

Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.

This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would

@jmacias
jmacias / reclaimWindows10.ps1
Created January 7, 2017 19:10 — forked from alirobe/reclaimWindows10.ps1
"Reclaim Windows 10" turns off a bunch of unnecessary Windows 10 telemetery, removes bloatware, and privacy invasions. Review and tweak before running. Scripts for reversing are included and commented. Fork via https://github.com/Disassembler0 (different defaults)
##########
# Win10 Initial Setup Script
# Author: Disassembler <[email protected]>
# Version: 1.7, 2016-08-15
# dasm's script: https://github.com/Disassembler0/Win10-Initial-Setup-Script/
# THIS IS A PERSONALIZED VERSION
# This script leaves more MS defaults on, including MS security features.
# Tweaked based on personal preferences for @alirobe 2016-11-16 - v1.7.1