This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.
To capture the video (filesize: 19MB), using the free "QuickTime Player" application:
#!/usr/bin/env bash | |
uninstall() { | |
list=`gem list --no-versions` | |
for gem in $list; do | |
gem uninstall $gem -aIx | |
done | |
gem list | |
gem install bundler | |
} |
#!/usr/local/bin/python | |
""" | |
To use this script, you must be in the root directory of a Rails project that | |
is using git. You should also make sure that your directory does not contain any | |
uncommitted changes. Then run: | |
$ python rails_switch_branch.py name_of_another_branch | |
Running the above will do the following: |
Magic words:
psql -U postgres
Some interesting flags (to see all, use -h
or --help
depending on your psql version):
-E
: will describe the underlaying queries of the \
commands (cool for learning!)-l
: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)import Data.ByteString.Lazy.Internal | |
import Data.Aeson | |
import Control.Applicative | |
data Person = Person String Int deriving (Show) | |
instance FromJSON Person where | |
parseJSON (Object p) = | |
Person <$> | |
(p .: "name") <*> |
-- | Main entry point to the application. | |
module Main where | |
import Control.Monad.Reader | |
import Control.Monad.Writer | |
{- | |
The ReaderT transformer is used to retrieve a read-only value from some environment. | |
The WriterT transformer will log the result of each retrieval. | |
Running the two transformers together yields a log of each step along with the actual results. |
Chronological list of the "systemd for Administrators" series published on 0pointer.net/blog:
{-# LANGUAGE DeriveGeneric #-} | |
{-# LANGUAGE TemplateHaskell #-} | |
import Control.Lens | |
import Data.Aeson | |
import qualified Data.ByteString.Lazy.Char8 as C | |
import GHC.Generics | |
-- For production code, use Text instead of String | |
data Person = Person { _personName :: String | |
, _personAge :: Int |