Skip to content

Instantly share code, notes, and snippets.

View danielbdias's full-sized avatar

Daniel Baptista Dias danielbdias

View GitHub Profile
@jexchan
jexchan / multiple_ssh_setting.md
Created April 10, 2012 15:00
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@pitch-gist
pitch-gist / gist:2999707
Created June 26, 2012 22:21
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active July 7, 2024 13:22
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@prwhite
prwhite / Makefile
Last active June 11, 2024 13:48
Add a help target to a Makefile that will allow all targets to be self documenting
# Add the following 'help' target to your Makefile
# And add help text after each target name starting with '\#\#'
help: ## Show this help.
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'
# Everything below is an example
target00: ## This message will show up when typing 'make help'
@echo does nothing
@myusuf3
myusuf3 / delete_git_submodule.md
Created November 3, 2014 17:36
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@ArturT
ArturT / .bash_profile
Last active June 26, 2021 05:55
Watch file changes and run rspec for the test file or specified line number test. Use spring with rspec optionally.
# It requries installed nodemon
# $ npm install -g nodemon
#
# Add this in your ~/.bash_profile
#
# How to use it?
#
# Run spec for user_spec.rb when file changed.
# $ wr spec/models/user_spec.rb
#
@mikob
mikob / AWS, ELB, CF and Let's Encrypt
Last active June 2, 2024 02:55
AWS, ELB, Let's Encrypt
Elastic Load Balancer, CloudFront and Let's Encrypt
@joemaffia
joemaffia / slackbot_reminder_bitbucket_pullrequests.py
Created July 19, 2017 08:37
Slack Bot reminder for Bitbucket pull requests
import os
import sys
import requests
import json
from datetime import tzinfo, timedelta, datetime
from dateutil.parser import parse
POST_URL = 'https://slack.com/api/chat.postMessage'
@marcosnils
marcosnils / awsmfa.sh
Last active March 19, 2021 17:34
Simple script to use MFA using AWS cli.
#!/bin/bash
# shellcheck disable=SC2102
set -euo pipefail
renew_creds() {
unset AWS_ACCESS_KEY_ID
unset AWS_SECRET_ACCESS_KEY
unset AWS_SESSION_TOKEN
@donvito
donvito / main.go
Last active May 21, 2024 12:58
AES-256 encrypt/decrypt in Go
package main
import (
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"encoding/hex"
"fmt"
"io"
)