Skip to content

Instantly share code, notes, and snippets.

View coderfi's full-sized avatar

Fairiz 'Fi' Azizi coderfi

View GitHub Profile
@djpadz
djpadz / aws-docker-login.rb
Created April 15, 2020 19:08
Log in to a docker repository in AWS ECR using the current profile
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'json'
require 'base64'
require 'open3'
puts 'Getting authorization token...'
out, status = Open3.capture2 'aws', 'ecr', 'get-authorization-token'
@htr3n
htr3n / macos-ramdisk.md
Last active April 8, 2024 21:43
Creating RAM disk in macOS

Built-in

diskutil erasevolume HFS+ 'RAM Disk' `hdiutil attach -nobrowse -nomount ram://XXXXX`

where XXXXX is the size of the RAM disk in terms of memory blocks.

Notes:

@coderfi
coderfi / requirements_user.txt
Last active March 29, 2019 22:47
Standard python user pip dev packages
# These are the standard pip packages
# I like to install in my user 'global' space.
# They generally do not belong in a project's
# requirements.txt file, and are almost always
# found in a file like requirement_dev.txt
#
# pip install --user requirements_user.txt
# echo 'export PATH=~/.local/bin:$PATH' >> ~/.bash_profile
autopep8>=1.4.3
@njanakiev
njanakiev / concat_images.py
Created March 28, 2019 15:32
Concat images in a matrix grid with Python and PIL
import os
import random
from PIL import Image, ImageOps
def concat_images(image_paths, size, shape=None):
# Open images and resize them
width, height = size
images = map(Image.open, image_paths)
images = [ImageOps.fit(image, size, Image.ANTIALIAS)
@coderfi
coderfi / IAMCredentials.json
Last active January 11, 2019 07:31 — forked from ServerlessBot/IAMCredentials.json
Credential set for Serverless Framework + AppSync + ElasticSearch + Cognito
{
"Statement": [
{
"Action": [
"apigateway:*",
"appsync:CreateApiKey",
"appsync:CreateDataSource",
"appsync:CreateFunction",
"appsync:CreateGraphqlApi",
"appsync:CreateResolver",
@ServerlessBot
ServerlessBot / IAMCredentials.json
Last active December 20, 2023 16:50
Minimum credential set for Serverless Framework
{
"Statement": [
{
"Action": [
"apigateway:*",
"cloudformation:CancelUpdateStack",
"cloudformation:ContinueUpdateRollback",
"cloudformation:CreateChangeSet",
"cloudformation:CreateStack",
"cloudformation:CreateUploadBucket",
@coderfi
coderfi / docker_mint18.sh
Created June 28, 2018 05:20 — forked from mcmaur/docker_mint18.sh
Install Docker on Linux Mint 18 Sylvia
#remove old
sudo apt-get remove docker docker-engine docker.io
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable"
@coderfi
coderfi / hive_spark_sql_md5_to_bigint.sql
Created March 23, 2018 18:16
HIVE/SPARK SQL convert md5 to bigint
-- takes the leftmost 16 hex-characters of the md5 hash of foo, converts it to base-10, and casts it to a 64-bit number
-- Note: this decreases the possible space of hashes!
SELECT CAST(conv(substring(md5("foo"), 0, 16), 16, 10) AS BIGINT)");
@DavidWells
DavidWells / serverless.yml
Created September 15, 2017 05:39
DynamoDB custom index serverless.yml example
service: service-name
provider:
name: aws
runtime: nodejs6.10
functions:
myfunc:
handler: handler.myfunc
@martinwicke
martinwicke / automobile.ipynb
Last active January 9, 2022 08:14
Estimator demo using Automobile dataset
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.