Skip to content

Instantly share code, notes, and snippets.

@haxorjim
haxorjim / mac.sh
Last active September 17, 2021 16:37
Metricbeat
brew tap elastic/tap
brew install elastic/tap/metricbeat-full
vi /usr/local/etc/metricbeat/metricbeat.yml
#output.logstash:
# hosts: ["elk.local:5044"]
brew services start elastic/tap/metricbeat-full

Keybase proof

I hereby claim:

  • I am haxorjim on github.
  • I am haxorjim (https://keybase.io/haxorjim) on keybase.
  • I have a public key whose fingerprint is 131A 3533 D6E7 F053 C747 9202 5DC4 1870 630A 1789

To claim this, I am signing this object:

@haxorjim
haxorjim / gh
Last active June 12, 2020 14:37 — forked from anderskig/Repo
Open a project file on GitHub.
#!/bin/bash
#
# Open the specified file on GitHub. It will use the master branch by default:
#
# gh app/controllers/application_controller.rb
#
# Specify the current branch:
#
# gh -c app/controllers/application_controller.rb
#
jsCache = {
expirationSeconds: 60,
cache: {},
cacheFunction: function (func, parameters) {
var value;
// generate the cache key using the function definition and parameters to be passed
@haxorjim
haxorjim / svn.js
Created December 3, 2015 13:55
Node.js SVN Module
var svn = module.exports = {};
var execSync = require("exec-sync"),
util = require('util');
// equivalent to svn log command
svn.log = function (options) {
// TOOD: modify this to accept an options object that configures the xml, v, limit, username, password variables
var log = execSync(util.format('%s log --xml -v -r%d:%d --username %s --password %s %s', options.svn, options.nextRevision, options.maxRevision, options.username, options.password, options.remote), true);
@haxorjim
haxorjim / gist:2009480
Created March 10, 2012 00:43
Tiny RSS Reader
<html>
<head>
<title>Tiny RSS</title>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
var feeds = [];
google.load("feeds", "1");
@haxorjim
haxorjim / gist:1371323
Created November 16, 2011 20:45
Validate Tracking Numbers in PL/SQL
function fedex12(p_tracking_number varchar2) return boolean is
trk varchar2(12);
tot number:=0;
mult number:=1;
chr varchar2(1);
begin
--if the data passed is 12 digits then strip everything but valid FedEx tracking number characters.
if length(p_tracking_number) = 12 then
for x in 1..length(p_tracking_number) loop
chr := upper(substr(p_tracking_number,x,1));
@haxorjim
haxorjim / PolylineEncoder.php
Created November 16, 2011 02:58
Encoding Polylines for Google Maps
<?php
// http://facstaff.unca.edu/mcmcclur/GoogleMaps/EncodePolyline/
$numLevels = 18;
$zoomFactor = 2;
$verySmall = 0.00001;
$forceEndpoints = true;
for($i = 0; $i < $numLevels; $i++)