Skip to content

Instantly share code, notes, and snippets.

View jvican's full-sized avatar

Jorge jvican

View GitHub Profile
@jsuereth
jsuereth / sbt-build-structure.md
Created June 15, 2015 14:56
Sbt build structure

Here's a short little guide to sbt's build structure.

First off, the key you need to investigate how sbt is building things. Here's a snippet from a build.sbt:

import sbt.Keys._
val bs: sbt.BuildStructure = buildStructure.value

This will give you all the gory details of our build (or builds, as is the case).

@bardo
bardo / README.md
Last active January 5, 2022 01:54
Watch a web page for edits with IFTTT and urlwatch

This setup allows to trigger an IFTTT event whenever a web page changes. It uses the urlwatch utility and the IFTTT Maker Channel.

Instructions:

  • Sign up to IFTTT.
  • Connect IFTTT's Maker Channel, and take note of your Maker key.
  • Create a new Recipe that takes the Maker Channel as input and outputs wherever you want. I used IF Notifications with the IF Android app, so that I get a notification on my phone whenever the trigger runs. The script passes the updated URL to IFTTT as value1, and my notification contains URL updated: {{Value1}}, so that I know which of the web pages has been updated.
  • On the machine that will check the website for changes install urlwatch and python2-requests.
  • Echo the URLs to check to ~/.urlwatch/urls.txt, one per line.
  • Then, copy over my hooks.py to ~/.urlwatch/libs/hooks.py adding the URLs to the ifttt_urls tuple and substituting YOUR_TRIGGER_NAME and YOUR_MAKER_KEY.
@olafurpg
olafurpg / PrettyPrintHack.scala
Last active March 3, 2016 12:38
Pretty-print/reformat AST trees in Scala using clang-format
ollie-scalafmt@ import scala.sys.process._
import scala.sys.process._
ollie-scalafmt@ import java.io.ByteArrayInputStream
import java.io.ByteArrayInputStream
ollie-scalafmt@ formatMe
res28: String = """
Defn.Object(Nil, Term.Name("State"), Template(Nil, Seq(Ctor.Ref.Name("ScalaFmtLogger")), Term.Param(Nil, Name.Anonymous(), None, None), Some(Seq(Defn.Val(Nil, Seq(Pat.Var.Term(Term.Name("start"))), None, Term.Apply(Term.Name("State"), Seq(Lit(0), Term.Name("identity"), Term.ApplyType(Term.Select(Term.Name("Vector"), Term.Name("empty")), Seq(Type.Name("Split"))), Term.ApplyType(Term.Select(Term.Name("Vector"), Term.Name("empty")), Seq(Type.Name("State"))), Lit(0), Term.ApplyType(Term.Select(Term.Name("Vector"), Term.Name("empty")), Seq(Type.Apply(Type.Name("Indent"), Seq(Type.Name("Num"))))), Lit(0)))), Defn.Def(Nil, Term.Name("reconstructPath"), Nil, Seq(Seq(Term.Param(Nil, Term.Name("toks"), Some(Type.Apply(Type.Name("Array"), Seq(Type.Name("FormatToken")))), None), Term.Param(Nil, Term.Name("splits"), Some(T
@abhijeetchopra
abhijeetchopra / 0-README.md
Last active January 11, 2026 04:54
Creating automatic scheduled backup copies of your Google Sheets using Google Apps Script

How to "Schedule Automatic Backups" of your Google Sheets

This tutorial demonstrates how to use Google Apps Script to:

  • Create copies of the Google Sheet in the desired destination folder automatically at set intervals.

  • Append the time stamp with each backup file's name.

  • Adjust time trigger for backing up every day/hour/minute.

@gkossakowski
gkossakowski / asSeenFrom.md
Last active June 19, 2018 18:27
Understand Scala's core typechecking rules

Scala's "type T in class C as seen from a prefix type S" with examples

Introduction

Recently, I found myself in need to precisely understand Scala's core typechecking rules. I was particulary interested in understanding rules responsible for typechecking signatures of members defined in classes (and all types derived from them). Scala Language Specification (SLS) contains definition of the rules but lacks any examples. The definition of the rules uses mutual recursion and nested switch-like constructs that make it hard to follow. I've written down examples together with explanation how specific set of rules (grouped thematically) is applied. These notes helped me gain confidence that I fully understand Scala's core typechecking algorithm.

As Seen From

Let's quote the Scala spec for As Seen From (ASF) rules numbered for an easier reference:

@lenborje
lenborje / Zip.java
Created June 2, 2016 12:19
Minimal zip utility in java. It can process entries in parallel. Utilizes Java 8 parallel Streams combined with the ZIP FileSystem introduced in Java 7.
import java.io.*;
import java.net.*;
import java.nio.file.*;
import java.util.*;
import java.util.stream.*;
import static java.util.stream.Collectors.*;
/**
* This class creates zip archives. Instead of directly using {@link java.util.zip.ZipOutputStream},
* this implementation uses the jar {@link FileSystem} available since Java 1.7.<p>
@bufordtaylor
bufordtaylor / icloud-caldav.rb
Created October 27, 2016 16:51 — forked from ericboehs/icloud-caldav.rb
Interface with Apple's iCloud CalDav Calendars
require 'rexml/document'
require 'rexml/xpath'
require 'http'
require 'icalendar'
HTTP::Request::METHODS = HTTP::Request::METHODS + [:report]
module AppleCalDav
class Client
attr_accessor :username, :password
@kekru
kekru / Docker connect to remote server.md
Last active March 21, 2025 01:29
Connect to another host with your docker client, without modifying your local Docker installation

Run commands on remote Docker host

This is how to connect to another host with your docker client, without modifying your local Docker installation or when you don't have a local Docker installation.

Enable Docker Remote API

First be sure to enable the Docker Remote API on the remote host.

This can easily be done with a container.
For HTTP connection use jarkt/docker-remote-api.

Revisiting Tagless Final Interpreters

Tageless Final interpreters are an alternative to the traditional Algebraic Data Type (and generalized ADT) based implementation of the interpreter pattern. This document presents the Tageless Final approach with Scala, and shows how Dotty with it's recently added implicits functions makes the approach even more appealing. All examples are direct translations of their Haskell version presented in the Typed Tagless Final Interpreters: Lecture Notes (section 2).

The interpreter pattern has recently received a lot of attention in the Scala community. A lot of efforts have been invested in trying to address the biggest shortcomings of ADT/GADT based solutions: extensibility. One can first look at cats' Inject typeclass for an implementation of [Data Type à la Carte](http://www.cs.ru.nl/~W.Swierstra/Publications/DataTypesA

@hofmannsven
hofmannsven / README.md
Created December 6, 2017 00:32
Increase key repeat rate on macOS

Increase key repeat rate on macOS

Settings: System Preferences » Keyboard » Key Repeat/Delay Until Repeat

Use the commands below to increase the key repeat rate on macOS beyond the possible settings via the user interface. The changes aren't applied until you restart your computer.

Source: https://apple.stackexchange.com/a/83923