Skip to content

Instantly share code, notes, and snippets.

# Android SDK setup
## Install Java
```bash
sudo apt-get update
sudo dpkg --add-architecture i386
sudo apt-get install libbz2-1.0:i386
sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1
sudo apt-get install openjdk-8-jdk openjdk-8-jre
@brock
brock / psql-with-gzip-cheatsheet.sh
Last active May 13, 2024 13:31
Exporting and Importing Postgres Databases using gzip
# This is just a cheat sheet:
# On production
sudo -u postgres pg_dump database | gzip -9 > database.sql.gz
# On local
scp -C production:~/database.sql.gz
dropdb database && createdb database
gunzip < database.sql.gz | psql database
@cies
cies / .spacemacs
Created September 13, 2015 12:44
My .spacemacs when trying to get a full features Haskell setup that is stack-aware
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration."
(setq-default
;; List of additional paths where to look for configuration layers.
;; Paths must have a trailing slash (i.e. `~/.mycontribs/')
dotspacemacs-configuration-layer-path '()
@526avijitgupta
526avijitgupta / spacemacs-cheatsheet.md
Last active August 29, 2023 12:31
Spacemacs cheatsheet

emacs --daemon to run in the background. emacsclient.emacs24 <filename/dirname> to open in terminal

NOTE: "M-m and SPC can be used interchangeably".

  • Undo - C-/
  • Redo - C-?
  • Change case: 1. Camel Case : M-c 2. Upper Case : M-u
  1. Lower Case : M-l
@Decoherence
Decoherence / TypeSafeRocket.hs
Last active August 29, 2015 14:19
Example: Type-safe rocket launch using the Either monad transformer.
module Main where
import Control.Monad.Trans
import Control.Monad.Trans.Either
import Safe
data Sensor = Temp
| Fuel
| Pressure
@Decoherence
Decoherence / Spock_PostgrSQL_Users.hs
Last active August 29, 2015 14:19
Haskell: Testing Spock web server using PostgreSQL backend and the 'users' library for user management & session handling.
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DeriveGeneric #-}
module Main where
import Database.PostgreSQL.Simple
import Data.Aeson hiding (json)
import Data.Monoid
import Data.Text (pack)
import GHC.Generics
@Decoherence
Decoherence / PrimeNumbers.hs
Last active August 29, 2015 14:19
Command-line utility to quickly generate prime numbers (Haskell)
import Control.Applicative
import Control.Monad
import Options
import Safe
{-
Command-line arguments:
-m: biggest prime less than m (required)
-l: show full list (optional)
@Decoherence
Decoherence / JSON_Lens_Auto_Derive.hs
Last active August 29, 2015 14:16
Haskell JSON: Demonstrates how to automatically derive JSON instances for easy encoding/decoding of a nested data record. Also construct lenses for easy viewing/modification of fields.
{-# 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
@Decoherence
Decoherence / ReaderT_and_WriterT.hs
Last active August 2, 2022 02:26
Haskell: Monad Transformers -- Combine ReaderT and WriterT
-- | 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.