Skip to content

Instantly share code, notes, and snippets.

View lucamolteni's full-sized avatar
🏠
Working from home

Luca Molteni lucamolteni

🏠
Working from home
View GitHub Profile
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active July 17, 2024 14:20
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@filipelenfers
filipelenfers / SlickBoneCP.scala
Last active October 18, 2016 07:57
Slick 2.0.0 + BoneCP
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Timestamp
import java.util.Date
import scala.slick.driver.MySQLDriver.simple._
//import scala.slick.driver.H2Driver.simple._
//MultipleDB examples, DAL included: https://github.com/slick/slick-examples/blob/2.0.0-M3/src/main/scala/com/typesafe/slick/examples/lifted/MultiDBExample.scala e https://github.com/slick/slick-examples/blob/2.0.0-M3/src/main/scala/com/typesafe/slick/examples/lifted/MultiDBCakeExample.scala
@staltz
staltz / introrx.md
Last active July 25, 2024 16:52
The introduction to Reactive Programming you've been missing
Xft.antialias: true
Xft.rgba: rgb
Xft.hinting: true
Xft.autohint: true
Xft.hintstyle: hintfull
@pixeltrix
pixeltrix / time_vs_datatime.md
Last active February 18, 2024 19:20
When should you use DateTime and when should you use Time?

When should you use DateTime and when should you use Time?

It's a common misconception that [William Shakespeare][1] and [Miguel de Cervantes][2] died on the same day in history - so much so that UNESCO named April 23 as [World Book Day because of this fact][3]. However because England hadn't yet adopted [Gregorian Calendar Reform][4] (and wouldn't until [1752][5]) their deaths are actually 10 days apart. Since Ruby's Time class implements a [proleptic Gregorian calendar][6] and has no concept of calendar reform then there's no way to express this. This is where DateTime steps in:

>> shakespeare = DateTime.iso8601('1616-04-23', Date::ENGLAND)
=> Tue, 23 Apr 1616 00:00:00 +0000
>> cervantes = DateTime.iso8601('1616-04-23', Date::ITALY)
=> Sat, 23 Apr 1616 00:00:00 +0000
@radix
radix / testing-free-monads.hs
Created September 20, 2015 21:07
Testing effectful programs in Haskell, take 2
-- With much thanks to Cirdec of Stack Overflow: http://stackoverflow.com/questions/32673144/how-do-i-compare-a-program-specified-as-a-free-monad-against-a-description-of-ex
{-# LANGUAGE GADTs #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE ViewPatterns #-}
import Text.Show.Functions
import Control.Monad.Operational
-- Core effect definition
@tanb
tanb / xhyve-freebsd-tutorial-1.md
Last active November 27, 2021 13:07
FreeBSD running on xhyve tutorial. (Appendix: Resize image with qemu. Create FreeBSD VM with qemu).

TL;DR

  • Create 5GB FreeBSD image.
  • Install FreeBSD on xhyve.
  • Mount host directory.

Requisites

@bryanedds
bryanedds / Alternative.cpp
Last active August 10, 2020 01:56
Abstract Data Types and Alternative Forms of Polymorphism in C++
#include "functional"
#include "iostream"
namespace proj
{
/// Polymorphism in C++ is typically implemented with dynamic dispatch. On the plus side, it's
/// easy to grasp (initially), well-understood, and works retroactively. On the minus side, it
/// sucks you into OOP quagmires too easily and is not terribly efficient. Knowing about other
/// types of polymorphims may lead you to avoid this approach wherever practical. Places where
/// it's practically unavoidable are those that require user-defined subtypes, such as plugins
@superjamie
superjamie / raspberry-pi-vpn-router.md
Last active July 2, 2024 07:48
Raspberry Pi VPN Router

Raspberry Pi VPN Router

This is a quick-and-dirty guide to setting up a Raspberry Pi as a "router on a stick" to PrivateInternetAccess VPN.

Requirements

Install Raspbian Jessie (2016-05-27-raspbian-jessie.img) to your Pi's sdcard.

Use the Raspberry Pi Configuration tool or sudo raspi-config to: