Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Loreto Parisi loretoparisi

Block or report user

Report or block loretoparisi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@loretoparisi
loretoparisi / find.js
Last active Apr 30, 2019
Find and Head with Node.js
View find.js
function scanDirStream(needle, params) {
var options = {
// find -type
type: 'f',
// find -name
name: '*',
limit: 100
};
for (var attrname in params) { options[attrname] = params[attrname]; }
return new Promise((resolve, reject) => {
@loretoparisi
loretoparisi / icu4c_macos.sh
Created Apr 29, 2019
Install icu4c on macOS
View icu4c_macos.sh
export ICU_VERSION=63.1
export PYICU_INCLUDES=/usr/local/Cellar/icu4c/63.1/include
export PYICU_LFLAGS=-L/usr/local/Cellar/icu4c/63.1/lib
export PYICU_CFLAGS=-std=c++11
pip install pyicu
@loretoparisi
loretoparisi / asyncio_python.py
Created Apr 18, 2019
Python Async Await with AsyncIO
View asyncio_python.py
import asyncio
async def demo():
print("foo")
await asyncio.sleep(5)
return "bar"
def main():
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
result = loop.run_until_complete(demo())
@loretoparisi
loretoparisi / awscat.sh
Last active Apr 18, 2019
AWS CAT - Cat a file from Aws Bucket in Bash
View awscat.sh
function __awscat {
if [ "$1x" != 'x' ]; then
aws s3 cp --quiet "$1" /dev/stdout
fi
}
alias awscat='__awscat'
@loretoparisi
loretoparisi / emoticons.js
Created Apr 17, 2019
Node.js JavaScript Emoticons text codes To Icons
View emoticons.js
module.exports = {
100: "💯",
1234: "🔢",
grinning: "😀",
smiley: "😃",
smile: "😄",
grin: "😁",
laughing: "😆",
satisfied: "😆",
sweat_smile: "😅",
@loretoparisi
loretoparisi / emoticons.json
Created Apr 17, 2019
A JSON trivial list of Emoticons
View emoticons.json
{
"100": "💯",
"1234": "🔢",
"grinning": "😀",
"smiley": "😃",
"smile": "😄",
"grin": "😁",
"laughing": "😆",
"satisfied": "😆",
"sweat_smile": "😅",
@loretoparisi
loretoparisi / randomHSVPalette.js
Created Apr 10, 2019
Generate a random HSV palette of non overlapping colors
View randomHSVPalette.js
function randomHSVPalette(options) {
function random(min, max) {
return min + Math.random() * (max - min);
}
function HSVtoXYZ(hsv) {
var h = hsv[0];
var s = hsv[1];
var v = hsv[2];
@loretoparisi
loretoparisi / python_randomness.py
Created Apr 8, 2019
Python Randomness - Reproducibility isn't a requirement, it's a necessity!
View python_randomness.py
# Set the seed for hash based operations in python
os.environ['PYTHONHASHSEED'] = '0'
seed=1234
# set the seed for random number generator
rn.seed(seed)
# Set the numpy seed
np.random.seed(seed)
@loretoparisi
loretoparisi / git_init_remote_origin.sh
Created Apr 5, 2019
Git Init from Remote Origin Master
View git_init_remote_origin.sh
git remote add origin https://github.com/loretoparisi/phoenix-elixir-boilerplate.git
git add *
git commit -m "Initial Import"
git push --set-upstream origin master
git push origin master
@loretoparisi
loretoparisi / phoenix_elixir_boilerplate.sh
Last active Apr 5, 2019
Phoenix Elixir Boilerplate: up and running in 3 minutes!
View phoenix_elixir_boilerplate.sh
brew update
brew install elixir
mix local.hex
mix archive.install hex phx_new 1.4.3
mix phx.new hello --no-ecto
cd hello
mix phx.server
You can’t perform that action at this time.