Skip to content

Instantly share code, notes, and snippets.

View johntron's full-sized avatar

John Syrinek johntron

View GitHub Profile
@johntron
johntron / build-gphoto.sh
Last active December 3, 2023 22:01
Build libgphoto2 and gphoto2
curl -OL https://github.com/gphoto/libgphoto2/releases/download/v2.5.31/libgphoto2-2.5.31.tar.gz
tar -xzf libgphoto2-2.5.31.tar.gz
cd libgphoto2-2.5.31/
sudo apt install libtool libusb-dev
./configure --prefix=/usr/local
make
sudo make install
ls -al /usr/local/lib/libgphoto2
curl -OL https://github.com/gphoto/gphoto2/releases/download/v2.5.28/gphoto2-2.5.28.tar.gz
tar -xzf gphoto2-2.5.28.tar.gz
@johntron
johntron / sdrplay_rsp2_fft.py
Last active January 18, 2018 13:11
Debugging recipe for SDRPlay RSP2 and gnuradio-companion (scroll down for GRC recipe)
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
##################################################
# GNU Radio Python Flow Graph
# Title: Sdrplay Rsp2 Fft
# Generated: Thu Jan 18 07:07:54 2018
##################################################
if __name__ == '__main__':
import ctypes
#!/bin/sh -
# We just download the bootstrap script by default and execute that.
if [ -x /usr/bin/fetch ]; then
/usr/bin/fetch -o - https://raw.githubusercontent.com/johntron/salt-bootstrap/hotfix/ubuntu-urllib3/bootstrap-salt.sh | sh -s -- "$@"
elif [ -x /usr/bin/curl ]; then
/usr/bin/curl -L https://raw.githubusercontent.com/johntron/salt-bootstrap/hotfix/ubuntu-urllib3/bootstrap-salt.sh | sh -s -- "$@"
else
python \
-c 'import urllib; print urllib.urlopen("https://raw.githubusercontent.com/johntron/salt-bootstrap/hotfix/ubuntu-urllib3/bootstrap-salt.sh").read()' \
<body style="font-family: sans-serif">
<h1>avalanche_app branches</h1>
<h2>6+ months since last commit</h2>
All of these will be deleted unless you speak up!
<ul>
<li>2013-04-11 15:17:12 -0700 remotes/origin/studio_port_middleware – already merged into master, safe to delete</li>
<li>2013-04-11 16:47:41 -0700 remotes/origin/Avalanche_Next_BLL – already merged into master, safe to delete</li>
<li>2013-05-23 17:23:36 -0700 remotes/origin/av_system_ui – already merged into master, safe to delete</li>
<li>2013-05-30 16:04:44 -0700 remotes/origin/general_css – already merged into master, safe to delete</li>
<li>2013-05-31 17:04:44 -0600 remotes/origin/av_system – already merged into master, safe to delete</li>
@johntron
johntron / gist:cc61a9887db9bc4f5f9b
Created April 17, 2015 18:03
Get CanJS Control from DOM elements
function handlers($el) {
$el = $($el);
var events = $._data(document.body).events;
var matched_handlers = [];
Object.keys(events).forEach(function(event_type) {
var handlers = events[event_type].filter(function (handler) {
if (!handler.selector) { return false; }
return $el.is(handler.selector) || $el.has(handler.selector).length;
});
matched_handlers = matched_handlers.concat(handlers)
<script src="https://code.jquery.com/jquery-1.11.2.min.js"></script>
<a href="asdf?foo=bar">clickme</a>
<a href="asdf?doo=gar">clickme2</a>
<script>
var $as = document.querySelectorAll('a');
[].forEach.call($as, function ($a) {
$($a).on('click', post);
});

The code below asks the user how many eggs they would like, ensures they enter a value, and renders a number of egg images matching the entered value. Update this code to ask the user how many dozens of eggs they would like, and render the one-dozen.gif image instead.

@johntron
johntron / gulpfile.js
Last active August 29, 2015 14:12
Gulpfile using Duo to build scripts
/*jslint node: true, sloppy:true */
var gulp = require('gulp'),
Duo = require('duo'),
through = require('through2'),
paths = {
scripts: ['src/boot.js'],
styles: ['src/*.css', 'src/**/*.css'],
images: ['src/*.png', 'src/**/*.png']
};
@johntron
johntron / run_task.sh
Created October 28, 2014 23:13
Run a task from the CLI
#!/local/pythonenv/bin/python
from pyramid.paster import bootstrap
import json
from axon.testcases.config import ConfigFactory
from axon.tasks.reservations import create
bootstrap('/local/web/Axon/development.ini')
c = """
[root@tomahawk ~]# echo '{"engine": "stc", "session": "b551df0e-f4d3-4aae-9a8b-7e6e0e8f2228", "file": "/local/web/data/captures/pcap-cb8ef148-eaf3-4ad6-b9b4-b7ef21245297.gz", "interface": "eth2", "max_bytes": 10737418240, "size": 0}' | /local/admin/start-capture -p
{
"detail" : "processing input parameters for (/local/admin/start-capture)"
}
{
"message" : "using capture interface eth2"
}
{