Skip to content

Instantly share code, notes, and snippets.

View danstn's full-sized avatar
🚀

Daniel Stankevich danstn

🚀
View GitHub Profile
@danstn
danstn / tmux.conf
Last active May 28, 2024 12:50
One file Tmux config
# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# quick config reload
bind r source-file ~/.tmux.conf
# Enable mouse control (clickable windows, panes, resizable panes)
set -g mouse on
@danstn
danstn / init.lua
Last active July 30, 2024 10:13
One File Neovim Config
-- Set <space> as the leader key
-- See `:help mapleader`
-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used)
vim.g.mapleader = "\\"
vim.g.maplocalleader = "\\"
-- Make line numbers default
vim.opt.number = true
vim.opt.tabstop = 4
@danstn
danstn / revproxy.go
Created January 10, 2023 04:59
Simple Go reverse proxy
package main
import (
"fmt"
"log"
"net/http"
"net/http/httputil"
"strings"
)
@danstn
danstn / init.vim
Created December 1, 2022 01:23
A millionth version of my vimrc
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" CORE
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set autoindent " enable automatic indentation
set expandtab
set hlsearch " highlight search results
set ignorecase " case insensitive search
set incsearch " match the search and return to the initial position
set list " Show `listchars` characters
@danstn
danstn / Demo.elm
Last active July 7, 2022 23:24
Experiment with state machines & elm-ui
module MachineDemo exposing
( Model
, init
, myDiv
, setHeight
, setMinHeight
, setWidth
)
import Element exposing (..)
@danstn
danstn / stack.ts
Created April 27, 2021 05:24
CDK Construct for React FE on S3/CloudFront with Route53 and HTTPS
export class InfrastructureStack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
// Create a new bucket
const bucket = new s3.Bucket(this, BUCKET_ID, {
bucketName: "<your-domain>",
websiteIndexDocument: "index.html",
autoDeleteObjects: true,
enforceSSL: true,
@danstn
danstn / hasql-extra.hs
Last active November 26, 2020 03:42
Hasql abstractions
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
module HasqlExtra where
import Data.UUID (UUID)
import qualified Hasql.Decoders as D
import Hasql.DynamicStatements.Snippet (Snippet, param, sql)
import Hasql.DynamicStatements.Statement (dynamicallyParameterized)
newtype PrivateData = PrivateData { ssshhh :: Text }
deriving (Eq, Show, Generic)
newtype PublicData = PublicData { somedata :: Text }
deriving (Eq, Show, Generic)
instance ToJSON PrivateData
instance ToJSON PublicData
type PublicAPI = Get '[JSON] [PublicData]
@danstn
danstn / home-ca.sh
Created April 25, 2017 13:32
Home Certificate Authority
#!/usr/bin/bash
set -e
echo -n "Enter server name (i.e. nginx-server): "
read server
echo "===> [INFO] Generating certs for: $server"
echo "===> [Step 1] Generating Certificate Request (CSR)..."
@danstn
danstn / reasonable.hs
Created March 29, 2016 15:29 — forked from aaronlevin/reasonable.hs
Reasonably Priced Monads in Haskell
-- | simple/basic Scala -> Haskell translation of Runar's presentation
-- | (https://dl.dropboxusercontent.com/u/4588997/ReasonablyPriced.pdf)
-- | trying to use minimal extensions and magic.
-- | (earlier I had a version using MultiParamTypeClasses for Runar's
-- | Inject class, but scraped it opting for simplicity)
-- | my question: what do we lose by moving towards simplicity?
-- | Future work: use DataKinds, TypeOperators, and potentially TypeFamilies
-- | to maintain and automate the folding of types in Coproduct.
{-# LANGUAGE Rank2Types, DeriveFunctor #-}