Skip to content

Instantly share code, notes, and snippets.

View TwistingTwists's full-sized avatar
💭
Elixir dev

Abhishek Tripathi TwistingTwists

💭
Elixir dev
View GitHub Profile
@TwistingTwists
TwistingTwists / RandomToTask.elm
Created October 6, 2019 11:13 — forked from JoelQ/RandomToTask.elm
Turn an Elm random generator into task, allowing it to be chained with other side effects.
-- 0.19
randomToTask : Generator a -> Task Never a
randomToTask generator =
Time.now
|> Task.map (Tuple.first << Random.step generator << Random.initialSeed << Time.posixToMillis)
-- 0.18
module ID exposing (ID(..), decodeFromString, decoder, encode, encodeAsString, fromInt, toInt, toString)
import Json.Decode as Decode exposing (Decoder)
import Json.Encode as Encode exposing (Value)
{-| This type ensures you get a type error if you for example accidentally pass a UserId in place of a CompanyId
-}
type ID phantom
= ID Int
@TwistingTwists
TwistingTwists / .gitignore
Created April 13, 2019 11:59 — forked from olooney/.gitignore
worked examples of argparse and python logging
logs/
port module Main exposing (main)
import Browser
import Html exposing (Html)
import Html.Attributes
import Html.Events
main =
Browser.element
{ init = init
@TwistingTwists
TwistingTwists / montage-dot.sh
Created March 26, 2019 03:20 — forked from drmalex07/montage-dot.sh
Merge (montage) multiple DOT files in a single PNG. #bash #graphviz #montage #dot
#!/bin/bash
#
# Create a single PNG image from a sequence of DOT files (describing a graph)
#
# Parse command line
outfile="graph.png"
@TwistingTwists
TwistingTwists / whiteboard.sh
Last active November 24, 2015 16:26 — forked from lyoshenka/whiteboard_clean.sh
This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.
#!/bin/bash
convert "$1" -resize %50 -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"
# source: http://www.reddit.com/r/commandline/comments/1weqnn/cli_oneliner_script_to_clean_up_and_beautify/