Skip to content

Instantly share code, notes, and snippets.

@renderorange
renderorange / every
Created November 1, 2021 17:22 — forked from sorbits/every
Run «command» only every «number» time invoked
#!/usr/bin/env bash
progname=$(basename $0)
version="1.0 (2014-08-17)"
step=2
function create_hash {
openssl dgst -sha1 -binary <<< "$1" | xxd -p
}
@renderorange
renderorange / NetwatchGatewayStates.rsc
Created July 2, 2020 01:11 — forked from heri16/NetwatchGatewayStates.rsc
Mikrotik RouterOS Script to do proper uplink failover/failback (more reliable than Netwatch)
# Mikrotik RouterOS Script to do proper uplink failover/failback (more reliable than Netwatch).
# Supports both Generic and PPPoE interfaces.
# Policy: read, write, policy, test
### Configuration ###
# Define Names of all Interfaces that will be checked:
:local "interface-names" { "internet-speedy";"internet-biznet" };
### Keybase proof
I hereby claim:
* I am renderorange on github.
* I am renderorange (https://keybase.io/renderorange) on keybase.
* I have a public key ASBLxJ15x3md42ou3JxrLUzHyLtWAkVXRNc4QwJYHuoH8wo
To claim this, I am signing this object:
@renderorange
renderorange / config
Last active March 27, 2019 00:10
ssh config for authentication with github
Host github.com
IdentityFile ~/.ssh/id_rsa
User git
@renderorange
renderorange / getSenateBillsPassed.js
Last active October 16, 2018 01:06
propublica GET request via javascript
const request = require( 'request' );
let options = {
url: 'https://api.propublica.org/congress/v1/115/senate/bills/passed.json',
headers: {
'X-API-Key': 'apikeygoeshere'
},
json: true
};
function Person( first, last ) {
this.firstName = first;
this.lastName = last;
}
Person.prototype.getInitials = function() {
let firstInitial = this.firstName.substring( 0, 1 ).toUpperCase();
let lastInitial = this.lastName.substring( 0 , 1 ).toUpperCase();
return firstInitial + lastInitial;
};
#!/usr/bin/perl
use strict;
use warnings;
use Getopt::Long;
use Pod::Usage;
$|=1;
#!/usr/bin/perl
use strict;
use warnings;
my ( $csv, $date_low, $date_high ) = @ARGV;
# my $counter = 0;
open( my $csv_fh, '<', $csv ) or die "open $csv: $!\n";
@renderorange
renderorange / change_this.php
Last active October 13, 2015 04:44
change_this
<?php
class Auth extends TestCase
{
private $auth_token;
// verify API response if invalid credentials
function test_invalid_credentials()
{
$this->post('/authenticate', ['email' => 'false', 'password' => 'false'])