Skip to content

Instantly share code, notes, and snippets.

View GregIngelmo's full-sized avatar

Greg Ingelmo GregIngelmo

View GitHub Profile
@GregIngelmo
GregIngelmo / gist:5542927
Last active December 17, 2015 03:28
Interactive Mongo queries
# Launch pry based interactive Rails console
$> pry -r ./config/environment.rb
# redirect Mongoid logging to console
pry(main)> Mongoid.logger = Logger.new($stdout)
# run a query
pry(main)> User.where(:username => "greg").first()
# Mongoid spits out the query, but, I actually want to see the raw Mongo query
@GregIngelmo
GregIngelmo / redhat.md
Last active August 29, 2015 14:00
Base config for Redhat Servers

Base config for Redat servers

Base dev libs

sudo yum groupinstall "Development Tools" -y

Install EPEL

@GregIngelmo
GregIngelmo / mitmproxy.md
Last active August 29, 2015 14:00
Mitmpoxy Notes

Mitmproxy

Type l and paste the following filter. It will remove all html specfic elements from a capture session.

!(~ts "application/javascript") !(~ts "text/javascript") !(~ts "text/css") !(~ts "image/*") !(~ts "application/vnd.google.safebrowsing-*")
@GregIngelmo
GregIngelmo / ping.md
Created May 9, 2014 22:09
Ping Utils

Ping Utils

Parse ping response time

brew install fping
fping -c 1 google.com 2&>1| head -n1 | cut -d "(" -f2 | cut -d " " -f1

Influx db

Execute a qeury via curl

http get "http://localhost:8086/db/test/series?u=root&p=root&q=select first(docCount) from /yahoo.search_ssb_customer.app.pyc_referralanalytics.search/ group by time(1d) where time > now() -48h"
@GregIngelmo
GregIngelmo / nslayoutconstraint_test.swift
Last active August 29, 2015 14:04
NSLayoutConstraint playground test
// how to programatically create NSLayoutConstraints inside a playground
import UIKit
let viewFrame = CGRect(x: 0, y: 0, width: 640, height: 750)
let view = UIView(frame: viewFrame)
view.backgroundColor = UIColor.greenColor()
// initially the subView will obscure the entire view
let subView = UIVisualEffectView(effect: UIBlurEffect(style: UIBlurEffectStyle.Dark))
@GregIngelmo
GregIngelmo / ffmpeg.md
Last active August 29, 2015 14:06
ffmpeg commands

ffmpeg commands

Rotate all videos in current directory 90 degrees and remove rotate metadata that's used by iOS & Quicktime.

find *.mp4 | xargs -I {} ffmpeg -i "{}" -v 0 -vf "transpose=1" -qscale 0 -y -metadata:s:v:0 "rotate=0" "rotated/{}"

Print the width, height and filename for every video in the current directory

@GregIngelmo
GregIngelmo / bolt_size.go
Created February 16, 2015 22:06
bolt issue 303
package main
import (
"fmt"
"log"
"os"
"github.com/boltdb/bolt"
)
@GregIngelmo
GregIngelmo / bolt_299.go
Created February 22, 2015 23:30
Bolt #299
package main
import (
"log"
"os"
"github.com/boltdb/bolt"
)
var path = "bolt.db"
package main
import (
"crypto/rand"
"fmt"
"io"
"net"
"sync/atomic"
"time"
)