Skip to content

Instantly share code, notes, and snippets.

View amingilani's full-sized avatar
💯
Always operating at maximum efficiency

Amin Shah Gilani amingilani

💯
Always operating at maximum efficiency
View GitHub Profile
@amingilani
amingilani / killem.rb
Created December 16, 2016 08:49
gist to kill all your digital ocean droplets fast
require 'droplet_kit'
token = '' # paste your token here
client = DropletKit::Client.new(access_token: token)
# if your droplets are named john-1, john-2, john-3
# @param spelledlike [String] type 'john'
# @return [Array<String>] ids of the killed droplets
def killem(spelledlike)
client.droplets.all.select {|e| e.name.include? spelledlike}
@amingilani
amingilani / .rubocop.yml
Last active March 25, 2018 02:27
This is my Rubocop setup
# Based on https://gist.github.com/jhass/a5ae80d87f18e53e7b56
AllCops:
TargetRubyVersion: 2.4
DisplayCopNames: true
Include:
- '**/Rakefile'
- '**/config.ru'
Exclude:
- '**/Guardfile'
@amingilani
amingilani / gh-pages-with-https.md
Last active October 21, 2021 18:48
gh pages with https

Always Available SSL Websites at $0

I have a secret that saves my clients a ton of money in the long run, keeps their website secure and has built in backups. I make their website static. I, then, store and host it with Github, and I finally use Cloudflare to serve it over HTTPS, and make it fast. My clients only ever pay for their domain name.

[TOC]

Why Static Content?

@amingilani
amingilani / ci-cd-draft.md
Last active February 26, 2017 20:41
Continuous Integration with Gitlab

Building a robust CI/CD pipeline for $0 with GitLab

I recently got the opportunity to kickstart a project from the ground up. I didn't want to overload my non-technical client with recurring billing for services he wouldn't need. I ended up taking the time to implement a CI/CD environment that deploys to Heroku for free. My client only has to pay for his production Heroku dyno, the rest of the build pipeline is either free or, in the case of the staging environment, running on the free tier.

While I was about to start a new project this weekend, I decided to take a moment to document my process to help myself and you with future projects. I'll outline some of my favorite practices for deployment environments and why I follow them. In this article we'll be hosting the code for a Ruby on Rails application I'm building, for a personal project, at GitLab.com. We'll be using their shared runners for CI/CD and deploying to Heroku in staging and p

@amingilani
amingilani / blockstack
Created November 13, 2017 17:23
blockstack
Verifying my Blockstack ID is secured with the address 1EpVLrG8PnYbXi261WjkidMo1iBswqfniV https://explorer.blockstack.org/address/1EpVLrG8PnYbXi261WjkidMo1iBswqfniV
@amingilani
amingilani / Readme.md
Last active February 16, 2020 14:48
Gitlab worker setup

In your digital ocean instance, use the following cloud-init script

#cloud-config

runcmd:
 - SCRIPT_URL=https://gist.githubusercontent.com/amingilani/09499c28a21a975cf84d51f7f5a68327/raw/gitlab-runner-install.sh
 - tmux new-session -s "InstallGitlabRunner" "curl $SCRIPT_URL | bash"
@amingilani
amingilani / quickSend.js
Created March 17, 2018 20:30
Quick script to send a group of people a message through Twilio. I needed this for a workshop I was conducting, and thought I might need it in the future.
// Edit these!
const accountSid = '';
const authToken = '';
const numbers = [];
const message = "";
// script to send the message
const client = require('twilio')(accountSid, authToken);
@amingilani
amingilani / rails_new.sh
Last active September 9, 2019 04:15
My personal command to create new Ruby on Rails apps
# Default
echo 'Type the name of your app' && \
read appname && \
rails new $appname \
--database=postgresql `# My database choice` \
--skip-turbolinks `# Who the hell uses these` \
--skip-test `# I like to use Rspec` \
--webpack=react
# MiniTest is fine
@amingilani
amingilani / terraform-output-failure.txt
Created October 8, 2018 18:28
Filing a bug report for terraform-providers/terraform-provider-google
$ terraform apply
google_container_cluster.primary: Refreshing state... (ID: worklark-cluster)
google_compute_firewall.default: Refreshing state... (ID: http-https)
google_container_node_pool.primary_pool: Refreshing state... (ID: us-central1-a/worklark-cluster/worklark-node-pool)
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
@amingilani
amingilani / read-test.txt
Last active October 30, 2018 20:54
SanDisk 128 GB Ali Express buy — f3 test results
f3read "/Volumes/NO NAME"
F3 read 7.1
Copyright (C) 2010 Digirati Internet LTDA.
This is free software; see the source for copying conditions.
SECTORS ok/corrupted/changed/overwritten
Validating file 1.h2w ... 2097152/ 0/ 0/ 0
Validating file 2.h2w ... 2097152/ 0/ 0/ 0
Validating file 3.h2w ... 2097152/ 0/ 0/ 0
Validating file 4.h2w ... 2097152/ 0/ 0/ 0