Skip to content

Instantly share code, notes, and snippets.

@crazed
crazed / gist:8048935
Created December 20, 2013 01:08
fios gre bgp
# show interfaces gr-0/0/0
unit 0 {
tunnel {
source $FIOS_IP;
destination $DESTINATION;
routing-instance {
destination fios-2;
}
}
family inet {
@crazed
crazed / gist:7670423
Last active September 7, 2023 22:20
getting a moto x back to stock on mac os x
  1. grab the moto-fastboot version of fastboot here

  2. grab the appropriate stock firmware here (tip: you want the one that matches your android build number in settings -> about phone)

  3. unzip this file somewhere and make it easy to run the moto-fastboot-osx64 command from step 1

  4. get your phone into fastboot mode, google it if needed but just power the phone off, hold the down volume key and power button for 3 seconds then let go, should get you there

  5. verify you are ready for flashing:

     ./moto-fastboot-osx64 devices
     -- should list a device --
    
  6. most of the time you just need to flash system and recovery images, so from your unzipped stock firmware files do this:

@crazed
crazed / test.py
Last active October 11, 2016 08:30
sample using trigger with a custom loader
import sys
import logging
import xml.etree.ElementTree as ET
import re
import types
from uuid import uuid4
import cyclone.httpclient
import cyclone.jsonrpc
@crazed
crazed / gist:5776270
Created June 13, 2013 18:45
logstash elasticsearch template
{
"template_logstash" : {
"order" : 0,
"template" : "logstash-*",
"settings" : {
"index.query.default_field" : "@message",
"index.number_of_replicas" : "1",
"index.number_of_shards" : "3",
"index.routing.allocation.total_shards_per_node" : "2",
"index.auto_expand_replicas" : "false"
@crazed
crazed / code-snippet.java
Created June 6, 2013 19:26
jruby null pointer exception
private JRubyInterceptor(String scriptPath, String className) {
this.scriptPath = scriptPath;
this.className = className;
try {
logger.info("Trying to read ruby script from " + scriptPath);
Reader reader = new FileReader(scriptPath);
jruby.eval(new BufferedReader(reader));
logger.info("Trying to create our interceptor class by evaluating " + className + ".new");
this.rubyInterceptor = jruby.eval(className + ".new");
@crazed
crazed / carbon.conf
Created January 23, 2013 15:32
two graphite instances, some data for statsd does not appear on the second (per relay-rules config), and it is not on the first machine either
[cache]
USER = apache
MAX_CACHE_SIZE = inf
MAX_UPDATES_PER_SECOND = 1000
MAX_CREATES_PER_MINUTE = 50
LINE_RECEIVER_INTERFACE = 0.0.0.0
ENABLE_UDP_LISTENER = False
UDP_RECEIVER_INTERFACE = 0.0.0.0
UDP_RECEIVER_PORT = 2003
PICKLE_RECEIVER_INTERFACE = 0.0.0.0
@crazed
crazed / bldpkg.sh
Created October 4, 2012 16:55
build mcollective pkgs on OS X
#!/bin/bash
MPATH=$1
BETCDIR='/etc/mcollective'
BRUBYDIR='/Library/Ruby/Site/1.8'
BSBINDIR='/usr/sbin'
BBINDIR='/usr/bin'
BLIBEXECDIR='/usr/libexec/mcollective'
BDOCDIR='/usr/share/doc/mcollective'
BLAUNCHDIR='/Library/LaunchDaemons'
BLOGDIR='/var/log/mcollective'
#!/usr/bin/env ruby
require 'rubygems'
require 'mcollective'
class MCollectiveCheck
NAGIOS_CRITICAL = 2
NAGIOS_WARNING = 1
NAGIOS_OK = 0
include MCollective::RPC
commit d9b01934d56a96d9f4ae2d6204d4ea78a36f5f36
Author: Ted Ts'o <tytso@mit.edu>
Date: Sat Apr 30 13:17:11 2011 -0400
jbd: fix fsync() tid wraparound bug
If an application program does not make any changes to the indirect
blocks or extent tree, i_datasync_tid will not get updated. If there
are enough commits (i.e., 2**31) such that tid_geq()'s calculations
wrap, and there isn't a currently active transaction at the time of
require 'net/https'
uri = URI.parse("https://blah.com/test")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true if uri.scheme == 'https'
request = Net::HTTP::Get.new(uri.path)
results = http.request(request)