Skip to content

Instantly share code, notes, and snippets.

View iMerica's full-sized avatar

Michael iMerica

  • Austin, Texas
View GitHub Profile
@iMerica
iMerica / pycharm.vmoptions
Created July 21, 2017 01:00
PyCharm VM Options
-Xms2048m
-Xmx2048m
-XX:ReservedCodeCacheSize=2048m
-XX:+UseCompressedOops
-Dide.no.platform.update=true

Keybase proof

I hereby claim:

  • I am imerica on github.
  • I am imichael (https://keybase.io/imichael) on keybase.
  • I have a public key ASAK1tg_-_AO3dIyv2usYyUeDQldYkHaLoP97ljTp7LgIgo

To claim this, I am signing this object:

@iMerica
iMerica / remove_old_images.sh
Last active March 15, 2018 17:09
Delete Docker Images that are older than N days
# Example: `remove_old_images 30` // Deletes all Docker Images 30 days or older
function remove_old_images() {
if [ $# -eq 0 ]
then
echo "Pass in the number of days"
exit 0
fi
docker images --format '{{.ID}} {{.CreatedAt}}' | \
awk '{print $1 " " $2 }' | \
@iMerica
iMerica / storage.py
Created April 24, 2018 17:56
Django Static Asset Versioning and Auto-Upload to S3/Cloudfront
from storages.backends.s3boto3 import S3Boto3Storage
from django.contrib.staticfiles.storage import ManifestFilesMixin
from tempfile import SpooledTemporaryFile
import os
class CustomStorage(ManifestFilesMixin, S3Boto3Storage):
""" Handles File Versioning + File Uploading to our CDN """
def _save_content(self, obj, content, parameters):
""" Hack to work around I/O error in Boto """

gif-from-tweet

There are so many great GIFs out there and I want to have copies of them. Twitter makes that harder than it should be by converting them to MP4 and not providing access to the source material. To make it easier, I made a bash pipeline that takes a tweet URL and a filename, extracts the MP4 from that tweet and uses ffmpeg to convert back to GIF.

Dependencies

  • ffmpeg
    • macOS: brew install ffmpeg
    • Ubuntu/Debian: apt install ffmpeg
@iMerica
iMerica / .gitlab-ci.yml
Created June 15, 2018 01:13
Docker based Gitlab CI workflow for Django
image: docker:latest
services:
- docker:dind
stages:
- build
- test
- push
@iMerica
iMerica / urls.py
Last active July 27, 2023 17:20
Email verification in Django Rest Framework, Django All-Auth, Django Rest-Auth. Suitable for Single Page Applications
urlpatterns = [
url(r'^rest-auth/registration/account-confirm-email/(?P<key>[-:\w]+)/$', ConfirmEmailView.as_view(), name='account_confirm_email'),
]
@iMerica
iMerica / .gitlab-ci.yml
Last active July 18, 2018 23:18
Automated Deployments of Create React Apps to Cloudfront using Scotty JS.
image: docker:latest
services:
- docker:dind
stages:
- build
- push
- deploy
@iMerica
iMerica / job_offer_decider.py
Created July 20, 2018 15:29
Job Offer Decision Making Framework
from dataclasses import dataclass
from typing import Sequence
""""
This is a proof of concept framework for selecting job offers.
The general idea is to remove emotions from the decision
making process and first think about whats important to you, then
compare each offer against those factors.
@iMerica
iMerica / docker-compose.yml
Last active May 28, 2021 18:36
Gitlab Docker Runners
version: '2'
services:
dind:
restart: always
privileged: true
volumes:
- /var/lib/docker
image: docker:18.06.0-ce-dind
command:
- --storage-driver=overlay2