Skip to content

Instantly share code, notes, and snippets.

View rehno-lindeque's full-sized avatar

Rehno Lindeque rehno-lindeque

View GitHub Profile
@SrPeixinho
SrPeixinho / gist:3c34f66fd86f12af165f
Last active November 23, 2024 06:04
Syntax considered harmful
-- When your code grows too big for a line:
separateParens = foldr (\ head tail -> if head == '(' then head : ' ' : tail else if head == ')' then ' ' : head : tail else head : tail) []
-- Your natural instinct is to add new lines and comments:
separateParens =
foldr (\ head tail ->
if head == '('
then head : ' ' : tail -- inserts space after left parens
@travisbhartwell
travisbhartwell / nix-shell-shebang.md
Last active September 3, 2025 08:17
nix-shell and Shebang Lines

NOTE: a more up-to-date version of this can be found on my blog

nix-shell and Shebang Lines

A few days ago, version 1.9 of the Nix package manager was released. From the release notes:

nix-shell can now be used as a #!-interpreter. This allows you to write scripts that dynamically fetch their own dependencies.

@queertypes
queertypes / FreeCoFree.hs
Created June 5, 2015 17:11
Exploring Free Monads, Cofree Comonads, and Pairings: DSLs and Interpreters
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-
Explores Free Monads (DSLs) and Cofree Comonads (interpreters) and
their relationship.
Most of the code in this file comes from (1) below. Only minor
modifications are made - semantics are preserved.
@diyan
diyan / gui_automation_python.md
Last active December 4, 2023 14:48
Desktop GUI automation in Python

Desktop

UI Automation. Desktop. Python

GUI toolkit agnostic

autopy - simple, cross-platform GUI automation toolkit. MIT - https://github.com/msanders/autopy/

  • 432 stars, 102 forks, 2950 monthly downloads at 2015-05-13
  • GUI toolkit agnostic
@TheSeamau5
TheSeamau5 / HackerNewsExample.elm
Last active September 23, 2018 00:24
Hacker news requests example
--------------------------
-- CORE LIBRARY IMPORTS --
--------------------------
import Task exposing (Task, ThreadID, andThen, sequence, succeed, spawn)
import Json.Decode exposing (Decoder, list, int, string, (:=), map, object2)
import Signal exposing (Signal, Mailbox, mailbox, send)
import List
---------------------------------
-- THIRD PARTY LIBRARY IMPORTS --
@andsens
andsens / convert_to_lastpass.py
Created March 3, 2015 22:37
Converts a passpack csv export to a lastpass csv export
#!/usr/bin/env python
from collections import Counter
import csv
all_tags = []
lines = []
with open('passpack.csv') as passwords_handle:
passwords = csv.reader(passwords_handle, delimiter=',',
quotechar='"', quoting=csv.QUOTE_MINIMAL)
@aioutecism
aioutecism / gist:2638bb9eaf9ffc13348c
Last active August 28, 2025 08:34
Set up a VPN Server (PPTP) on AWS and use it anywhere

Set up a VPN Server (PPTP) on AWS

  1. Create a EC2 instance using Ubuntu 14.04.
  2. In Secure Group Inbound Rules, add a SSH Rule(TCP, Port 22, 0.0.0.0/0) and a Custom TCP Rule(TCP, Port 1723, 0.0.0.0/0).
  3. Optional: Associate a Elastic IP with the instance.
  4. SSH into the instance.
  5. sudo apt-get install pptpd.
  6. sudo vim /etc/pptpd.conf. Uncomment localip 192.168.0.1 and remoteip 192.168.0.234-238,192.168.0.245.
  7. sudo vim /etc/ppp/pptpd-options. Uncomment ms-dns and ms-wins. Change the IP to Google's DNS like this:
@chrisdone
chrisdone / HoleyMonoid.hs
Last active November 7, 2015 10:51
HoleyMonoid monoid!
{-# LANGUAGE FlexibleInstances #-}
-- | Monoids with holes. The 'HoleyMonoid' allows building monoidal values of which certain components are to be filled in later. For example:
--
-- > > let holey = now "x = "
-- > . later show
-- > . now ", y = "
-- > . later show
-- > > run holey 3 5
-- > "x = 3, y = 5"
--
@jadonk
jadonk / README.md
Last active October 7, 2017 03:35
Access Point on BeagleBone Black
#!/bin/bash -e
name=$(sed -n -e 's/^[nN]ame:\s\+\(.\+\)/\1/p' *.cabal)
old_ver=$(sed -n -e 's/^[vV]ersion:\s\+\(.\+\)/\1/p' *.cabal)
has_docs=1
grep -i '^Library' *.cabal || has_docs=0
echo "Package name: $name"
echo "Current version: $old_ver"
echo "Has documentation: $has_docs"