Skip to content

Instantly share code, notes, and snippets.

Avatar

Nathan Marley nmarley

View GitHub Profile
@nmarley
nmarley / gencert.rb
Last active Aug 25, 2015
Ruby script to generate SSL certificates
View gencert.rb
#! /usr/bin/env ruby
#
# gencert.rb
# =====================================================================
# description: This script will accepts an FQDN as an argument
# and generates a Secure Sockets Layer (SSL)
# certificate request and a private key that corresponds
# to the request. It will not overwrite any existing
# files, so file <fqdn>.cnf , <fqdn>.csr , or <fqdn>.key
# exist, the program will print a message and exit.
@nmarley
nmarley / parse_wci.rb
Last active Aug 29, 2015
WorldCoinIndex parser
View parse_wci.rb
require 'nokogiri'
require 'bigdecimal'
require 'bigdecimal/util'
require 'ap'
require 'pp'
def text_to_number(text)
val = text.dup
val.gsub!(/\s+/, '')
@nmarley
nmarley / analyze-tarsnap-usage.rb
Last active Aug 29, 2015
Analyse Tarsnap Usage
View analyze-tarsnap-usage.rb
require 'open3'
require 'pp'
def get_stats(archive_name)
cmd = "sudo tarsnap --print-stats -f #{archive_name}"
stats = run_cmd(cmd)[3,4]
end
def get_uniq_comp_size(stats)
stats.last.split(/\s+/)[-1]
@nmarley
nmarley / check.rb
Last active Aug 29, 2015
Domain Expiration Checker
View check.rb
#! /usr/bin/env ruby
require 'whois'
require 'date'
require 'time'
require 'pp'
require 'awesome_print'
class Chequer
def initialize
@nmarley
nmarley / fresh-cats.json
Last active Aug 29, 2015
Freshbooks Category list - 2015-08-29
View fresh-cats.json
[
{
"category_id": "00002254911",
"name": "Other Expenses",
"parent_id": null
},
{
"category_id": "00002254912",
"name": "Reference Materials",
"parent_id": "00002254911"
@nmarley
nmarley / README.md
Last active Aug 31, 2015
Sett print stylesheet suggestion
View README.md

Print stylesheet for SETT blogs - hide print obstructions

Stylesheet for removing HTML elements from SETT blogs which obstruct printing and making it easy to print/render to PDF format.

Because blue light from computer screens is hard on my eyes, I like to print longer web pages/posts and read them on paper. But sometimes it's hard to print without using the developer tools and stripping away elements from the HTML manually.

@nmarley
nmarley / README.md
Last active Oct 1, 2015
Dash upgrade script(s)
View README.md

Dash upgrade scripts.

Steps:

  1. Update location/file version in script 'prep-dash-release.sh'.
  2. Then distribute prep-dash-release.sh script by executing 'dist.sh'
  3. If any new masternodes are added, add them to dist.sh
  4. Login to individual servers and run:
@nmarley
nmarley / LICENSE
Last active Oct 5, 2015
Dash binary downloads - check most recent version
View LICENSE
The MIT License (MIT)
Copyright (c) 2015 Nathan Marley
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@nmarley
nmarley / dash.service
Created Oct 20, 2015
INCOMPLETE systemd dashd service script
View dash.service
[Unit]
Description=Dash server
After=syslog.target
After=network.target
[Service]
Type=forking
User=<dash user>
Group=<dash group>
ExecStart=<dash_path>/dashd
@nmarley
nmarley / run.sh
Last active Oct 25, 2015
Ansible ssh host key scan and set variable
View run.sh
#! /bin/bash
ansible-playbook -e hostname=github.com ssh-host-key-lookup.yml