This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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])) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Control.Monad.Reader | |
hello :: Reader String String | |
hello = do | |
name <- ask | |
return ("hello, " ++ name ++ "!") | |
bye :: Reader String String | |
bye = do | |
name <- ask |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ReaderMonad where | |
import Control.Monad.Reader | |
stuff :: Reader Int String | |
stuff = do | |
s <- ask | |
return (show s ++ " green bottles") | |
main :: IO () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
# | |
# Simple Bloom filter implementation in Python 3 | |
# Copyright 2017 Hector Martin "marcan" <[email protected]> | |
# 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): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### 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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
module Transformers where | |
import Control.Applicative | |
import Control.Monad | |
import qualified Data.Char as Char |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### To download a file from your ec2 ubuntu instance to your local computer CURRENT directory | |
``` | |
scp -i ~/.ssh/YourPrivateKey.pem -r [email protected]:/home/ubuntu/folderYouCareAbout/ . | |
``` | |
### To restore a mongodb database | |
mongorestore --db dbname dbfolder | |
NewerOlder