Skip to content

Instantly share code, notes, and snippets.

View v0d1ch's full-sized avatar
:octocat:
compiling...

Sasha Bogicevic v0d1ch

:octocat:
compiling...
View GitHub Profile
@v0d1ch
v0d1ch / ses.hs
Last active March 6, 2018 23:32
aws ses list identities
module Helper.Aws
(listAllEmails
) where
import Control.Lens ((&), (.~))
import Control.Monad.Trans.AWS (Error, runAWST, trying, _Error)
import Data.ByteString (ByteString)
import Network.AWS (Region (NorthVirginia), newEnv, runResourceT, send, within)
import Network.AWS.Auth (AccessKey (..), Credentials (FromKeys), SecretKey (..))
import Network.AWS.SES (IdentityType (..))
@v0d1ch
v0d1ch / yesod_streaming.txt
Last active January 25, 2018 11:52
yesod streaming
body <- getRequest
lift $ runConduitRes $ (consumeBody body) =$ sinkFile directory
where
consumeBody :: MonadIO m => YesodRequest -> ConduitM i ByteString m ()
consumeBody body = do
chunk <- liftIO $ NW.requestBody $ reqWaiRequest body
if (chunk == BS.empty)
then return ()
else do
yield chunk
@v0d1ch
v0d1ch / yesodaccount-custom.hs
Created April 15, 2017 14:36 — forked from stla/authaccountcustom.hs
Yesod Auth Account custom login page
{-# LANGUAGE QuasiQuotes, TypeFamilies, GeneralizedNewtypeDeriving #-}
{-# LANGUAGE FlexibleContexts, FlexibleInstances, TemplateHaskell, OverloadedStrings #-}
{-# LANGUAGE GADTs, MultiParamTypeClasses, TypeSynonymInstances #-}
import Data.Text (Text)
import Data.ByteString (ByteString)
import Database.Persist.Sqlite
import Control.Monad.Logger (runStderrLoggingT)
import Yesod
import Yesod.Auth
@v0d1ch
v0d1ch / nginx-default
Last active October 9, 2020 07:46
nginx yesod setup as reverse proxy
upstream yesod {
server 127.0.0.1:3000;
keepalive 8;
}
# the nginx server instance
server {
listen 0.0.0.0:80;
server_name haskell-serbia.com;
access_log /var/log/nginx/access_yesod.log;
@v0d1ch
v0d1ch / find_in_git.txt
Last active September 8, 2016 12:44
Find changed files in git by extension
find . -iname '*.scss' -exec git log --since=2.weeks --name-status {} +
@v0d1ch
v0d1ch / vim range
Created March 31, 2015 20:58
vim range
:put =range(11,15)
@v0d1ch
v0d1ch / vim array
Created March 31, 2015 20:56
vim create array
:for i in range(1,10) | put ='array['.i.']' | endfor
@v0d1ch
v0d1ch / vimgist
Last active September 29, 2023 12:48
vim replace newline with comma
1,$s/\n/,/g #replace comma with new line
%norm A* #append * to every line
bufdo! %s/FIND/REPLACE/g # search all buffers
@v0d1ch
v0d1ch / select time box
Last active August 29, 2015 14:09
select time box
<select name="new-event-start">
<option value="05:00">5:00</option>
<option value="05:15">5:15</option>
<option value="05:30">5:30</option>
<option value="05:45">5:45</option>
<option value="06:00">6:00</option>
<option value="06:15">6:15</option>
<option value="06:30">6:30</option>
<option value="06:45">6:45</option>
@v0d1ch
v0d1ch / PS jsx script
Last active August 29, 2015 14:09
jsx photoshop to save every png file in subfolders as jpg
var traverseFolder = function(path)
{
// Create new folder object based on path string
var folder = new Folder(path);
// Get all files in the current folder
var files = folder.getFiles();
// Loop over the files in the files object
for (var i = 0; i < files.length; i++)