Skip to content

Instantly share code, notes, and snippets.

View coderfi's full-sized avatar

Fairiz 'Fi' Azizi coderfi

View GitHub Profile
@coderfi
coderfi / concat_images.py
Created August 11, 2021 23:45 — forked from njanakiev/concat_images.py
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 / macos-ramdisk.md
Created April 27, 2021 21:33 — forked from htr3n/macos-ramdisk.md
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 / EncryptedHomeFolder.md
Created February 28, 2021 22:04 — forked from chetstone/EncryptedHomeFolder.md
Encrypted APFS Home Folder on Mac OSX

Encrypted APFS Home Folder on Mac OSX

Note: This is an update of Will Haley's excellent post to use APFS instead of CoreStorage.

UPDATE: Doesn't work on Catalina

The script can't read the file containing the password on the USB thumb drive. When formatted as FAT32 as described below, the user/group of the file is unknown/unknown. But I also tried formatting the USB thumb drive in HFS+, unchecking "Ignore permissions on this volume" and changing the file owner to root:wheel. The file is still not readable to the boot process. Probably something to do with new security restrictions in Catalina. A script running as root reading data from a thumb drive? Makes sense.

Back to previous program

@coderfi
coderfi / zsh-virtualenv-setup.md
Created March 29, 2019 22:46 — forked from hminnovation/zsh-virtualenv-setup.md
ZSH Virtualenv and Virtualenvwrapper setup

### Installing global Python & Pip Use Brew brew install python

That'll install both Python, PIP and setuptools. If for some reason it didn't install PIP you can do via

curl https://bootstrap.pypa.io/get-pip.py > get-pip.py
sudo python get-pip.py

c/f MacOSX setup gitbook

@coderfi
coderfi / example_aws_lambda_cloudformation_context.md
Created February 6, 2019 02:26 — forked from gene1wood/example_aws_lambda_cloudformation_context.md
Details on the AWS Lambda LambdaContext context object when instantiated from a CloudFormation stack

LambdaContext

Here is the raw output from examining the LambdaContext context object in a AWS Lambda function when called from a CloudFormation stack. More information on the context object can be found here : http://docs.aws.amazon.com/lambda/latest/dg/python-context-object.html

LambdaContext object : print(context)

<__main__.LambdaContext object at 0x7fd706780710>

LambdaContext vars : vars(context)

@coderfi
coderfi / serverless.yml
Created January 9, 2019 02:04 — forked from DavidWells/serverless.yml
DynamoDB custom index serverless.yml example
service: service-name
provider:
name: aws
runtime: nodejs6.10
functions:
myfunc:
handler: handler.myfunc
@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",
@coderfi
coderfi / ecverify.sol
Created October 11, 2018 18:05 — forked from axic/ecverify.sol
Ethereum ECVerify
//
// The new assembly support in Solidity makes writing helpers easy.
// Many have complained how complex it is to use `ecrecover`, especially in conjunction
// with the `eth_sign` RPC call. Here is a helper, which makes that a matter of a single call.
//
// Sample input parameters:
// (with v=0)
// "0x47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad",
// "0xaca7da997ad177f040240cdccf6905b71ab16b74434388c3a72f34fd25d6439346b2bac274ff29b48b3ea6e2d04c1336eaceafda3c53ab483fc3ff12fac3ebf200",
// "0x0e5cb767cce09a7f3ca594df118aa519be5e2b5a"
@coderfi
coderfi / Upgrading HDF5 and h5py to use SWMR with h5 files.md
Created August 25, 2018 16:30 — forked from geyang/Upgrading HDF5 and h5py to use SWMR with h5 files.md
hdf5 v1.10 upgrade/installation instruction for using single-write-multiple-read (SWMR) in h5py.

The new 1.10 version of hdf5 library is stable. You can now install from the source to use this new capability.

The installation process has a few caveats, so here is how to do it.

Note:

  1. you need to first remove the hdf5 libraries currently installed in ubuntu.
  2. Then you need to reinstall h5py.
  3. when you reinstall h5py via pip, use the --no-binary flag. This is because the h5py wheel comes with its own hdf5 binary.

Instructions:

@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"