Skip to content

Instantly share code, notes, and snippets.

View giulioungaretti's full-sized avatar
💭
😘

Giulio Ungaretti giulioungaretti

💭
😘
View GitHub Profile
@klaftertief
klaftertief / reactiveconf-2016-lightning-talk.md
Last active April 2, 2024 20:17
An API search engine in Elm for Elm, proposal for a Lightning Talk at ReactiveConf 2016

An API search engine in Elm for Elm

Elm is a statically typed functional language that compiles to JavaScript. It's well-known for its developer experience: the compiler provides nice error messages, the package system enforces semantic versioning for all published packages and makes sure every exposed value or type has some documentation and type annotations.

-- interface is a more familiar name for the intention of the construct
type alias Append a rest = { rest | append : a -> a -> a}
-- implement is a more familiar name
stringAppend rest = {rest | append = \x y -> x ++ y}
-- this is Monoid
type alias AppendWithId a rest = Append a {rest | id : a}
-- ^ 1 potential superclass
@carymrobbins
carymrobbins / setup-postgresql-vagrant.md
Last active May 4, 2023 10:22
Configure PostgreSQL in a Vagrant guest to allow connections from the host.

Configure Postgres

  • Update pg_hba.conf (most likely in /etc/postgresql/9.4/main) with -
    • host all all 0.0.0.0/0 trust
  • Update postgresql.conf to use listen_addresses = '*'
  • Be sure to sudo service postgresql restart

Configure Vagrant

@andreas-h
andreas-h / r_stl.py
Created December 5, 2013 16:30
Python-wrapper for R's STL
# -*- coding: utf-8 -*-
import datetime
from numpy import asarray, ceil
import pandas
import rpy2.robjects as robjects
def stl(data, ns, np=None, nt=None, nl=None, isdeg=0, itdeg=1, ildeg=1,
nsjump=None, ntjump=None, nljump=None, ni=2, no=0, fulloutput=False):
"""
Helper module for displaying ROOT canvases in ipython notebooks
Usage example:
# Save this file as rootnotes.py to your working directory.
import rootnotes
c1 = rootnotes.default_canvas()
fun1 = TF1( 'fun1', 'abs(sin(x)/x)', 0, 10)
c1.SetGridx()
"""
An XPUB/XSUB broker that forwards subscriptions
"""
import os
import string
import sys
import time
from random import randint
from threading import Thread
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active April 19, 2024 11:00
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:

@jongbinjung
jongbinjung / ViNavigation.ahk
Created December 14, 2012 17:48
Vi-like navigation for AutoHotKey
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
; HotKey to Initiate VI-mode with Double-tap of Alt
Shift::
If (A_PriorHotKey = "Shift" AND A_TimeSincePriorHotKey < 200)
{
; Set the flags for OSD
Gui, 99:+AlwaysOnTop -Caption +ToolWindow +Disabled -SysMenu +Owner
@kconragan
kconragan / keyrepeat.shell
Last active December 4, 2023 03:40
Enable key repeat in Apple Lion for Sublime Text in Vim mode
# Mac OS X Lion introduced a new, iOS-like context menu when you press and hold a key
# that enables you to choose a character from a menu of options. If you are on Lion
# try it by pressing and holding down 'e' in any app that uses the default NSTextField
# for input.
#
# It's a nice feature and continues the blending of Mac OS X and iOS features. However,
# it's a nightmare to deal with in Sublime Text if you're running Vintage (Vim) mode,
# as it means you cannot press and hold h/j/k/l to move through your file. You have
# to repeatedly press the keys to navigate.