Skip to content

Instantly share code, notes, and snippets.

@aterreno
aterreno / nginx.conf
Created August 12, 2013 07:20
Let's say that for some reason you want to execute an OS command via HTTP.. This nginx config does it by using LUA. http://openresty.org/ kicks ass.
worker_processes 1;
user root;
error_log logs/error.log;
events {
worker_connections 1024;
}
http {
server {
listen 8080;
location / {
@aterreno
aterreno / sp_generate_inserts.sql
Last active May 12, 2021 10:17
Amazing SQL Script to generate 'SQL inserts' for a MSSQL database - orginally by Narayana "Vyas" Kondreddi
SET NOCOUNT ON
GO
PRINT 'Using Master database'
USE master
GO
PRINT 'Checking for the existence of this procedure'
IF (SELECT OBJECT_ID('sp_generate_inserts','P')) IS NOT NULL --means, the procedure already exists
BEGIN
@aterreno
aterreno / .gitconfig
Last active January 25, 2021 17:00
my .gitconfig
[user]
name = Antonio Terreno
email = antonio.terreno@example.com
[alias]
aliases = !git config --get-regexp alias | sed -re 's/alias\\.(\\S*)\\s(.*)$/\\1 = \\2/g'
up = !git pull --rebase --autostash
co = checkout
br = branch
ci = commit
st = status
@aterreno
aterreno / cloner.sh
Created January 6, 2021 09:46
Clones all repos in an org, needs an auth token
function cloner {
curl -H "Authorization: token $1" -s "https://api.github.com/orgs/$2/repos?per_page=1000" \
| sed -n '/"ssh_url"/s/.*ssh_url": "\([^"]*\).*/\1/p' \
| sort -u \
| xargs -n1 git clone;
}
@aterreno
aterreno / even.js
Created December 16, 2020 19:19
https://coderpad.io/sandbox in javascript with mocha tests
const Mocha = require ('mocha')
const assert = require('chai').assert
const mocha = new Mocha ({ui: 'bdd'})
mocha.suite.emit('pre-require', this, 'solution', mocha)
const even = (n) => n % 2 === 0;
describe('Test suite', () => {
it('should work', () => {
@aterreno
aterreno / athena.sql
Last active March 24, 2020 23:31
How to automatically create CloudWatch alerts with CloudTrail, Lambda, and Serverless
SELECT DISTINCT eventname
FROM cloudtrail_logs_chargedup_cloudtrail
@aterreno
aterreno / index.js
Last active September 10, 2019 17:43
serverless-http & iopipe
const serverless = require("serverless-http");
const express = require("express");
const app = express();
// require("express-async-errors");
app.get("/hello", function(_req, res, _next) {
console.log("Hello, World");
try {
res.status(200).json({
@aterreno
aterreno / scrum_master.sh
Last active May 10, 2019 14:39
Scrum Master
#!/usr/bin/env bash
set -euf -o pipefail
scrum=("What did you work on yesterday?" "What are you going to work on today?" "Any blockers?" "Good progress" "Well done" "Any update on this?")
RANDOM=$$$(date +%s)
selected=${scrum[$RANDOM % ${#scrum[@]} ]}
say $selected
@aterreno
aterreno / Brewfile
Created January 14, 2019 09:04
Brewfile @ Work Laptop
tap "concourse/tap"
tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/core"
brew "autojump"
brew "python"
brew "awscli"
brew "base64"
brew "ccat"
brew "dockutil"
@aterreno
aterreno / cloudSettings
Created October 26, 2018 08:14
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-10-26T08:14:32.613Z","extensionVersion":"v3.2.0"}