Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View flyinprogrammer's full-sized avatar

Alan Scherger flyinprogrammer

View GitHub Profile
#include <stdio.h>
#include <stdint.h>
typedef uint32_t DWORD;
typedef uint16_t WORD;
int main(int argc, char *argv[]) {
char *filename = "firmware.bin";
FILE *input_file;
@flyinprogrammer
flyinprogrammer / artifactory_integration_test.sh
Created April 15, 2019 02:19
Your Product is Broken: Artifactory
#!/bin/bash
## Setup a VM
vagrant init ubuntu/xenial64
vagrant up
## Install OpenJDK 8
sudo add-apt-repository ppa:rpardini/adoptopenjdk
sudo apt-get update
sudo apt-get install adoptopenjdk-8-jdk-hotspot-set-default
@flyinprogrammer
flyinprogrammer / repo_backup.sh
Created December 17, 2018 17:13
Scripts for backing up and restoring Git repositories.
#!/bin/bash
set -e
BUNDLE_NAME=${1}
: "${BUNDLE_NAME:?Name of the bundle file should be the first argument.}"
REPO_URL=${2}
: "${REPO_URL:?URL of the repo to clone should be the second argument.}"
BUNDLE_FILE=$(pwd)/${BUNDLE_NAME}.bundle
### Keybase proof
I hereby claim:
* I am flyinprogrammer on github.
* I am flyinprogrammer (https://keybase.io/flyinprogrammer) on keybase.
* I have a public key ASBHVn2EEKCZ3NNvX-HgR6R95K7snb_xPI-GZTG9fTyixQo
To claim this, I am signing this object:
@flyinprogrammer
flyinprogrammer / install_hashicorp.sh
Created February 1, 2018 03:33
Install all the hashicorp tools.
#!/usr/bin/env bash
set -e
CONSUL_VERSION=1.0.3
NOMAD_VERSION=0.7.1
VAULT_VERSION=0.9.3
TERRAFORM_VERSION=0.11.2
PACKER_VERSION=1.1.3
tee hashicorp.asc <<EOF
@flyinprogrammer
flyinprogrammer / cloud-init.bash
Last active December 26, 2017 06:52
switch clocksource to tsc on boot - ubuntu 16.04
## Step 1) install/ensure sysfsutils is installed
sudo apt-get install sysfsutils
# ---------------------------------
# Manage /sys filesystem. Requires sysfsutils package
## Turn off THP
sudo tee -a /etc/sysfs.d/thp.conf <<-EOF
kernel/mm/transparent_hugepage/enabled = never
kernel/mm/transparent_hugepage/khugepaged/defrag = 0
@flyinprogrammer
flyinprogrammer / clean.sh
Created December 22, 2014 04:15
Ubuntu vagrant cleanup script
#!/bin/bash
# Unmount project
umount /vagrant
# Tell installer to keep en_US
echo en_US > /etc/locale.gen
# Install localepurge - NO dpkg
apt-get install -y localepurge
localepurge
apt-get remove -y pollinate overlayroot fonts-ubuntu-font-family-console cloud-init python-apport landscape-client juju chef open-vm-tools localepurge
@flyinprogrammer
flyinprogrammer / dup2_ex1_4.go
Created February 15, 2016 00:37
dup2 from The Go Programming Language (ISBN-13: 978-0134190440)
// dup2
//
// Prints the count and text of the lines that appear more than once in the input.
// It reads from stdin or from a list of named files.
//
// The original version simply printed the line and total count across all inputs.
// The exercise asked you to modify it to print all the anmes of the files in which
// each duplicated line occurs.
//
package main
@flyinprogrammer
flyinprogrammer / jruby_time_bug.md
Created June 11, 2013 18:12
inverted timezone in jruby?
class Time

  # Convert a time that is 'milliseconds since epoch' to a Time object
  #
  # @return [Time] A time object created from a 'milliseconds since epoch' timestamp
  def self.from_millisecond_epoch time
    Time.at(time / 1000)
  end
#!/usr/bin/env ruby
require 'date'
require 'mongoid'
Mongoid::Config.connect_to("email_test")
class Email
include Mongoid::Document
field :headers
field :received