Skip to content

Instantly share code, notes, and snippets.

View bioform's full-sized avatar

Andrew Krasnoff bioform

View GitHub Profile
@bioform
bioform / Makefile
Created November 3, 2024 09:57 — forked from alexedwards/Makefile
Boilerplate Makefile for Go projects
# Change these variables as necessary.
main_package_path = ./cmd/example
binary_name = example
# ==================================================================================== #
# HELPERS
# ==================================================================================== #
## help: print this help message
.PHONY: help
@bioform
bioform / viper-like-node-config.go
Created November 2, 2024 20:07 — forked from affanshahid/viper-like-node-config.go
Using spf13/viper like node-config
package main
import (
"fmt"
"os"
"strings"
"github.com/spf13/viper"
)
@bioform
bioform / nvmCommands.js
Created November 9, 2020 12:50 — forked from chranderson/nvmCommands.js
Useful NVM commands
// check version
node -v || node --version
// list installed versions of node (via nvm)
nvm ls
// install specific version of node
nvm install 6.9.2
// set default version of node
@bioform
bioform / nodejs-ubuntu-bind-port-80.md
Created November 9, 2020 12:45 — forked from drawveloper/nodejs-ubuntu-bind-port-80.md
Allow Node.js to bind to privileged ports without root access on Ubuntu

How to: Allow Node to bind to port 80 without sudo

TL;DR

Only do this if you understand the consequences: all node programs will be able to bind on ports < 1024

sudo setcap 'cap_net_bind_service=+ep' /usr/local/bin/node

Important: your node location may vary. Use which node to find it, or use it directly in the command:

@bioform
bioform / revert-a-commit.md
Created February 3, 2020 16:42 — forked from gunjanpatel/revert-a-commit.md
Git HowTo: revert a commit already pushed to a remote repository

Revert the full commit

Sometimes you may want to undo a whole commit with all changes. Instead of going through all the changes manually, you can simply tell git to revert a commit, which does not even have to be the last one. Reverting a commit means to create a new commit that undoes all changes that were made in the bad commit. Just like above, the bad commit remains there, but it no longer affects the the current master and any future commits on top of it.

git revert {commit_id}'

About History Rewriting

Delete the last commit

Deleting the last commit is the easiest case. Let's say we have a remote origin with branch master that currently points to commit dd61ab32. We want to remove the top commit. Translated to git terminology, we want to force the master branch of the origin remote repository to the parent of dd61ab32:

@bioform
bioform / mailhog-install.md
Created January 25, 2020 13:46 — forked from viktorpetryk/mailhog-install.md
MailHog installation on Ubuntu

Install & Configure MailHog

  1. Download and make it executable
wget https://github.com/mailhog/MailHog/releases/download/v1.0.0/MailHog_linux_amd64
sudo cp MailHog_linux_amd64 /usr/local/bin/mailhog
sudo chmod +x /usr/local/bin/mailhog
  1. Make MailHog as a service
#!/bin/bash
TEAM=$1
BRANCH=$2
OWNED_PATTERNS=$(cat ./.github/CODEOWNERS|grep @toptal/$TEAM |cut -d' ' -f1| sed -e 's/^/\.\//')
OWNED_FILES=`git ls-files $OWNED_PATTERNS`
git fetch origin $BRANCH:$BRANCH
CHANGED_FILES=`git diff --name-only $BRANCH $(git merge-base $BRANCH origin/master)`
echo "--------------------------------------------"
Hi! Ping! I'm here to request a review from you guys in this PR (https://github.com/toptal/platform/pull/29923).
To make it easier for you to review it, here's the list of files in your domain that we touched:
--------------------------------------------
app/models/talent.rb
If you see more files which are in your domain - update
https://github.com/toptal/platform/blob/master/.github/CODEOWNERS
please.
Thanks in advance! :high-five:
@bioform
bioform / clear-sidekiq-jobs.sh
Created October 3, 2018 10:42 — forked from wbotelhos/clear-sidekiq-jobs.sh
Clear Sidekiq Jobs
# 1. Clear retry set
Sidekiq::RetrySet.new.clear
# 2. Clear scheduled jobs
Sidekiq::ScheduledSet.new.clear
# 3. Clear 'Processed' and 'Failed' jobs
@bioform
bioform / gist:2db00f5d2cb8c53e8ff0e365edeb3b68
Created December 26, 2017 09:59 — forked from lttlrck/gist:9628955
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote