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
@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 / 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.

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"
#!/usr/bin/env ruby
require 'rubygems'
require 'bundler'
require 'fileutils'
require 'net/http'
require 'net/https'
require 'uri'
TMP_DIR = "/tmp/gems"

I just had to set up Jenkins to use GitHub. My notes (to myself, mostly):

Detailed Instructions

For setting up Jenkins to build GitHub projects. This assumes some ability to manage Jenkins, use the command line, set up a utility LDAP account, etc. Please share or improve this Gist as needed.

Install Jenkins Plugins