Skip to content

Instantly share code, notes, and snippets.

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

Hyperreal Gopher hyperrealgopher

🏠
Working from home
View GitHub Profile
@dino-
dino- / string-conversions.hs
Last active May 3, 2024 08:57
A handy illustration of converting between String, Text and ByteString in Haskell
#! /usr/bin/env stack
-- stack --resolver lts-18.8 script
{-# LANGUAGE OverloadedStrings #-}
{-
This is a handy illustration of converting between five of the commonly-used
string types in Haskell (String, ByteString, lazy ByteString, Text and lazy
Text).
@andrevdm
andrevdm / Scotty_websockets.hs
Last active March 6, 2024 01:51
Using websockets with scotty haskell
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Protolude
import qualified Web.Scotty as Sc
import qualified Data.Text as Txt
import qualified Network.Wai.Middleware.Gzip as Sc
@qti3e
qti3e / README.md
Last active April 13, 2024 15:50
List of file signatures and mime types based on file extensions
@bgromov
bgromov / git-reset-author.sh
Created June 23, 2016 17:50
Git: reset author for ALL commits
#!/bin/sh
# Credits: http://stackoverflow.com/a/750191
git filter-branch -f --env-filter "
GIT_AUTHOR_NAME='Newname'
GIT_AUTHOR_EMAIL='new@email'
GIT_COMMITTER_NAME='Newname'
GIT_COMMITTER_EMAIL='new@email'
" HEAD
@u0d7i
u0d7i / disable_vim_auto_visual_on_mouse.txt
Last active February 27, 2024 14:08
Disable vim automatic visual mode on mouse select
Disable vim automatic visual mode on mouse select
issue: :set mouse-=a
add to ~/.vimrc: set mouse-=a
my ~/.vimrc for preserving global defaults and only changing one option:
source $VIMRUNTIME/defaults.vim
set mouse-=a
@patik
patik / how-to-squash-commits-in-git.md
Last active October 17, 2023 02:19
How to squash commits in git

Squashing Git Commits

The easy and flexible way

This method avoids merge conflicts if you have periodically pulled master into your branch. It also gives you the opportunity to squash into more than 1 commit, or to re-arrange your code into completely different commits (e.g. if you ended up working on three different features but the commits were not consecutive).

Note: You cannot use this method if you intend to open a pull request to merge your feature branch. This method requires committing directly to master.

Switch to the master branch and make sure you are up to date:

@PurpleBooth
PurpleBooth / README-Template.md
Last active May 22, 2024 13:17
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@MattCheely
MattCheely / portal:about-me:html
Created July 31, 2012 21:07
Page layout templates using mustache inheritance.
{{! this is a specific (dummy) page with a menu in the 'portal' application}}
{{< portal/prototypes/menuPage.html}}
{{$pageId}}aboutMe{{/pageId}}
{{$pageTitle}}
{{#i18n}}aboutMe.title{{/i18n}}
{{/pageTitle}}
{{$pageContent}}
{{#i18n}}aboutMe.title{{/i18n}}
{{/pageContent}}
@endolith
endolith / consonance.py
Last active January 27, 2023 16:47
Functions for just intonation, consonance, roughness, dissonance, etc. in Python
"""
Collection of functions related to musical consonance, Just intonation, etc.
"""
from fractions import Fraction
from math import log
from functools import reduce
def product(*iterable):