Skip to content

Instantly share code, notes, and snippets.

View iMerica's full-sized avatar
🥂
Happy New Year

Michael iMerica

🥂
Happy New Year
  • Austin, Texas / SF, Bay Area
View GitHub Profile
@iMerica
iMerica / fizz-buzz.sh
Last active December 20, 2018 23:09
CLI Fizz Buzz One Liner
#!/usr/bin/env bash
# MIT License
# Copyright (c) 2018 @iMerica (Michael)
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
@iMerica
iMerica / functional-utils.js
Created December 11, 2018 18:25 — forked from bendc/functional-utils.js
A set of pure ES2015 functions aimed to make functional JavaScript more idiomatic.
// array utils
// =================================================================================================
const combine = (...arrays) => [].concat(...arrays);
const compact = arr => arr.filter(Boolean);
const contains = (() => Array.prototype.includes
? (arr, value) => arr.includes(value)
: (arr, value) => arr.some(el => el === value)
@iMerica
iMerica / authentication.py
Last active September 7, 2018 00:27
Custom Auth for Django/DRF that allows for multiple API Tokens per user.
from rest_framework.authentication import TokenAuthentication
from .models import RESTAPIToken
class CustomRestAPIAuthentication(TokenAuthentication):
""" Custom Authentication """
def get_model(self):
return RESTAPIToken
@iMerica
iMerica / filter.js
Last active July 30, 2018 06:35
Work At A Startup Job Filter
const findJobs = (remote, min_salary) => {
return window.TOP_LEVEL_PROPS.companies.filter(
company => company.jobs.filter(
job => ((job.remote_ok === remote) && (job.salary_max >= min_salary))
).length > 0
)
}
@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
@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 / .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 / 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
Created June 15, 2018 01:13
Docker based Gitlab CI workflow for Django
image: docker:latest
services:
- docker:dind
stages:
- build
- test
- push

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