Skip to content

Instantly share code, notes, and snippets.

@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 / gist:b5448baeb204eb816eb9
Created December 28, 2015 18:32
jq deep merge
➜ ~ cat a.json
{
"_meta": {
"tag_environment_magic": [
"a"
]
}
}
➜ ~ cat b.json
{
@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'
@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 / example.py
Created January 3, 2014 02:52
example doing parallel junos pyez execution
import time
from multiprocessing import Pool
from pprint import pprint
from optopus import Client, OPTOPUS_ENDPOINT
from jnpr.junos import Device
# work in progress
class MetaStore(object):
"""
@crazed
crazed / ip.rb
Created December 2, 2011 21:42
useful facter plugins
if File::exists?("/sbin/ip")
Facter.add('gateway') do
setcode do
`/sbin/ip route show`.match(/^default.*/)[0].match(/(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/)[0]
end
end
end
@crazed
crazed / gist:8323783
Last active January 2, 2016 15:29
dhcpd config for juniper ztp
option option-150 code 150 = ip-address;
option space JUNOS_ZTP;
option JUNOS_ZTP.config-file-name code 1 = text;
option JUNOS_ZTP.image-file-type code 2 = text;
option JUNOS_ZTP.transfer-mode code 3 = text;
option JUNOS_ZTP.alt-image-file-name code 4= text;
option JUNOS_ZTP-encapsulation code 43 = encapsulate JUNOS_ZTP;
subnet 172.16.200.0 netmask 255.255.255.0 {
@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: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");