Skip to content

Instantly share code, notes, and snippets.

View webdev's full-sized avatar
💭
Exploring Awesomenesss

George Blazer webdev

💭
Exploring Awesomenesss
  • San Francisco, CA
View GitHub Profile
@webdev
webdev / Rakefile
Created April 15, 2019 20:06 — forked from schickling/Rakefile
Activerecord without Rails
require "active_record"
namespace :db do
db_config = YAML::load(File.open('config/database.yml'))
db_config_admin = db_config.merge({'database' => 'postgres', 'schema_search_path' => 'public'})
desc "Create the database"
task :create do
ActiveRecord::Base.establish_connection(db_config_admin)
@webdev
webdev / check_iam_login_MFA.sh
Created August 25, 2017 19:43 — forked from shokoe/check_iam_login_MFA.sh
Nagios plugin for checking that all AWS IAM login userhave MFA
#!/bin/bash
# for debugging:
# aws iam generate-credential-report
# NOTE: generate will work only once every 4 hours - http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_getting-report.html
# aws iam get-credential-report --output text | awk '{print $1}' | base64 -d | head -1 | sed 's#,#\n#g' | cat -n
# aws iam get-credential-report --output text | awk '{print $1}' | base64 -d | awk -F, '{print $1, $4, $5, $8, $9, $14, $19, $21}' | column -t
unset PYTHONPATH
aws iam generate-credential-report &>/dev/null
#sleep 10
tell application "Safari"
repeat
repeat with i from (count of tabs of window 1) to 1 by -1
set thisTab to tab i of window 1
set current tab of window 1 to thisTab
delay 1
end repeat
end repeat
end tell
@webdev
webdev / Dockerfile
Created December 9, 2016 20:18
Go docker
# golang image where workspace (GOPATH) configured at /go.
FROM golang:latest
# Copy the local package files to the container's workspace.
ADD . /go/src/github.com/webdev/golang-docker
# Build the golang-docker command inside the container.
RUN go install github.com/webdev/golang-docker
# Run the golang-docker command by default when the container starts.
@webdev
webdev / gist:4b7064449095158123ef7d51b5142ef4
Created September 16, 2016 18:09 — forked from mislav/gist:938183
Faraday SSL example
connection = Faraday::Connection.new('http://example.com') do |builder|
builder.request :url_encoded # for POST/PUT params
builder.adapter :net_http
end
# same as above, short form:
connection = Faraday.new 'http://example.com'
# GET
connection.get '/posts'
@webdev
webdev / rails.rb
Created August 31, 2016 15:19 — forked from simi/rails.rb
Rails 3.1.1 Webrick with SSL support
#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
require 'rubygems'
require 'rails/commands/server'
require 'rack'
require 'webrick'
require 'webrick/https'
module Rails
@webdev
webdev / gist:0225cd595810b379714b
Created March 15, 2016 23:25 — forked from tonyc/gist:1384523
Using strace and lsof

Using strace and lsof to debug blocked processes

You can use strace on a specific pid to figure out what a specific process is doing, e.g.:

strace -fp <pid>

You might see something like:

select(9, [3 5 8], [], [], {0, 999999}) = 0 (Timeout)

@webdev
webdev / gist:7e24ea6235cea6c2bffe
Created July 13, 2015 21:31
Self-signed Certificate
# https://gist.github.com/jessedearing/2351836
function check_ssl_cert() {
local hostname=$1
local ssl_dir=/etc/travis/ssl
local ssl_name=${hostname//./_}
local ssl_path=$ssl_dir/$ssl_name
mkdir -p $ssl_dir
@webdev
webdev / sse.go
Last active August 29, 2015 14:14 — forked from ismasan/sse.go
package main
import (
"fmt"
"log"
"net/http"
"time"
)
// Example SSE server in Golang.