Skip to content

Instantly share code, notes, and snippets.

View brock's full-sized avatar
😎

Brock Angelo brock

😎
View GitHub Profile
@brock
brock / markdown-details-collapsible.md
Created July 17, 2019 19:48 — forked from pierrejoubert73/markdown-details-collapsible.md
How to add a collapsible section in markdown.

A collapsible section with markdown

Click to expand!

Heading

  1. A numbered
  2. list
    • With some
    • Sub bullets
@brock
brock / __init__.py
Created December 26, 2018 15:50 — forked from theorm/__init__.py
Pluggable API using Flask MethodView.
# -*- coding: utf-8 -*-
from .bananas import Bananas
from .base import the_api
the_api.add_url_rule('/bananas', view_func=Bananas.as_view('bananas'))
the_api.add_url_rule('/farm/<farm_id>/bananas', view_func=Bananas.as_view('bananas_from_a_farm'))
__all__ = [
@brock
brock / extract_exceptions.py
Created September 4, 2018 15:05 — forked from originell/extract_exceptions.py
Python Traceback Extractor from text/log files.
"""
Extract unique Python-Exceptions with their Traceback from a log/text file.
Usage::
python extract_exceptions.py -f logfile.txt
Furthermore it supports excluding exceptions you don't want to have::
python extract_exceptions.py -f logfile.txt -e ValueError,AttributeError

[exec_sh] mLast updated: 2015-01-18

Searching for Files

###Find images in a directory that don't have a DateTimeOriginal###

exiftool -filename -filemodifydate -createdate -r -if '(not $datetimeoriginal) and $filetype eq "JPEG"' .

###Output photos that don't have datetimeoriginal to a CSV### Note this can take a long time if you have a lot of jpgs

@brock
brock / 0_reuse_code.js
Created October 29, 2013 19:07
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@brock
brock / README.md
Created August 9, 2013 01:08 — forked from mbbx6spp/README.md

Distributed or Dancer Shell

Similar to ansible command but allows you to use any command that will work in your shell. Not tied to specific configuration management tooling, just SSH and your default shell on remote systems. Just works. I <3 it :)

What does it do?

Runs commands across potentially many machines. Allows you to organize your servers/VMs/instances into groups very easily.

Getting Started

#!/usr/bin/env ruby
#
# stevie_chambers@viewyonder.com July 2012
#
# I'm playing around with APIs, and sharing my learnings
# You can follow my trials and tribulations at http://viewyonder.com/apis
#
# This is a simple Ruby script to show how a simple API might work.
# The resource model is just a simple array of a single class - no back-end store (yet)
#
@brock
brock / json_postgres.js
Created October 14, 2015 14:52 — forked from lucdew/json_postgres.js
Example of json document storage in postgresql and querying (with knex.js)
var connectionString = 'postgres://localhost:5432/postgres';
var Promise=require('bluebird');
var knex = require('knex')({
client: 'pg',
connection: {
user: 'postgres',
database: 'postgres',
port: 5432,
@brock
brock / gist:4123148
Created November 21, 2012 05:11 — forked from yuhonas/gist:4122118
iTerm / Sublime AppleScript
tell application "System Events"
# create an iTerm session if we dont have one
if not (exists (processes where name is "iTerm")) then
tell application "iTerm" to (make new terminal)
end if
tell application "iTerm"
activate
tell the current terminal
set SublimeSessionName to "sublime"
@brock
brock / vimblog.vim
Created November 21, 2012 04:55 — forked from gavinzhou/vimblog.vim
vimblog
" Requirements:
" - you'll need VIM compiled with Ruby scripting support
" - example: for Debian/Ubuntu: sudo apt-get install vim-ruby
" - please, copy this file to one of your VIM dir
" - example: to your .vim home folder: $HOME/.vim/vimlog.vim
" - please, add this code to your .vimrc file:
"
" if !exists('*Wordpress_vim')
" runtime vimlog.vim
" endif