Skip to content

Instantly share code, notes, and snippets.

View LispyAriaro's full-sized avatar

Efe Ariaroo LispyAriaro

  • London, United Kingdom
View GitHub Profile
let _ = require('underscore');
const a = ["QyOeRrWi", "OnQzQl", "KrHz", "ZyRp", "WrZzOiSo", "t", "QcAuEpGsDa", "TcOc", "eUvTlTpOr", "Yg"]
const b = ["gWnBq", "aSvHo", "zLyBkGaEo", "zGc", "Ia", "nGgEu", "Nz", "JaIu", "zOeEq", "xEoOt"]
let secondAnswer = _.flatten(_.zip(a, b));
@LispyAriaro
LispyAriaro / clean-object-for-firestore-recursively
Created May 5, 2018 03:39
Clean object for firestore recursively
let clean = (obj) => {
let dateCounter = 0;
function traverse(parent, key) {
if (_.isDate(parent[key])) {
parent[key] = parent[key].getTime(); //convert to timestamp
dateCounter++;
}
if (_.isArray(parent[key])) {
@LispyAriaro
LispyAriaro / reader.hs
Created December 31, 2017 23:23 — forked from egonSchiele/reader.hs
Reader monad example
import Control.Monad.Reader
hello :: Reader String String
hello = do
name <- ask
return ("hello, " ++ name ++ "!")
bye :: Reader String String
bye = do
name <- ask
@LispyAriaro
LispyAriaro / ReaderMonad.hs
Created December 31, 2017 23:23 — forked from davidallsopp/ReaderMonad.hs
Simple example of the Reader Monad (in Haskell)
module ReaderMonad where
import Control.Monad.Reader
stuff :: Reader Int String
stuff = do
s <- ask
return (show s ++ " green bottles")
main :: IO ()
@LispyAriaro
LispyAriaro / bloom.py
Created December 15, 2017 19:46 — forked from marcan/bloom.py
Simple Bloom filter implementation in Python 3 (for use with the HIBP password list)
#!/usr/bin/python3
#
# Simple Bloom filter implementation in Python 3
# Copyright 2017 Hector Martin "marcan" <marcan@marcan.st>
# Licensed under the terms of the MIT license
#
# Written to be used with the Have I been pwned? password list:
# https://haveibeenpwned.com/passwords
#
# Download the pre-computed filter here (629MB, k=11, false positive p=0.0005):
@LispyAriaro
LispyAriaro / tips-on-go-lang-arrays-and-slices
Last active November 29, 2017 13:22
Helpful tips on using Go lang arrays and slices
- Once an array is declared, neither the type of data being stored nor its length can be changed.
- You can have an array of pointers.
```
array := [5]*int{0: new(int), 1: new(int)}
// Assign values to index 0 and 1.
*array[0] = 10
*array[1] = 20
@LispyAriaro
LispyAriaro / Efe_Ariaroo-Keybase-proof-of-github-account
Created October 22, 2017 19:37
Efe Ariaroo - Keybase proof of github account
### Keybase proof
I hereby claim:
* I am lispyariaro on github.
* I am efe_ariaroo (https://keybase.io/efe_ariaroo) on keybase.
* I have a public key ASCrGd6PoG-QLCXUE72cwax6LfOo6VYlt3tEoW1YCUUdNQo
To claim this, I am signing this object:
@LispyAriaro
LispyAriaro / transformers.hs
Created October 22, 2017 18:56 — forked from abhin4v/transformers.hs
An exploration of Monad Transformers in Haskell
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FlexibleInstances #-}
module Transformers where
import Control.Applicative
import Control.Monad
import qualified Data.Char as Char
@LispyAriaro
LispyAriaro / Some Helpful Rust Things
Last active October 5, 2017 09:15
Rustlang quick helpful rules
- There can be only one owner of a value
- Ownership of a value can be given to something else. When this is done through re-assignment, it is called Move semantics.
- However, primitive types like integers that have the Copy trait already implemented for them will be copied when re-assigned.
These are called Copy Types.
- Passing a value directly to a function gives ownership to that function
- Values initialized within a function WILL BE DROPPED AT THE END OF THE FUNCTION except you go out of your way to return it.
@LispyAriaro
LispyAriaro / Helpful-Ssh-Scp-MongoDb
Created August 27, 2017 23:26
Helpful - Scp - Ssh - MongoDb commands
### To download a file from your ec2 ubuntu instance to your local computer CURRENT directory
```
scp -i ~/.ssh/YourPrivateKey.pem -r ubuntu@ec2-xxx-xxx-xxx.compute-1.amazonaws.com:/home/ubuntu/folderYouCareAbout/ .
```
### To restore a mongodb database
mongorestore --db dbname dbfolder