Skip to content

Instantly share code, notes, and snippets.

@flyinprogrammer
flyinprogrammer / artifactory_integration_test.sh
Created Apr 15, 2019
Your Product is Broken: Artifactory
View artifactory_integration_test.sh
#!/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 Dec 17, 2018
Scripts for backing up and restoring Git repositories.
View repo_backup.sh
#!/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
View gist:bf01655381cd6ae1f587abc249c0ea73
### 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 Feb 1, 2018
Install all the hashicorp tools.
View install_hashicorp.sh
#!/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 Dec 26, 2017
switch clocksource to tsc on boot - ubuntu 16.04
View cloud-init.bash
## 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 / dup2_ex1_4.go
Created Feb 15, 2016
dup2 from The Go Programming Language (ISBN-13: 978-0134190440)
View dup2_ex1_4.go
// 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
View ifrepo.pp
if manage_repo
yumrepo {'repo':
enabled => 1,
gpgcheck => 1,
}
end
package { 'package':
ensure => latest,
if Yumrepo['repo'] was defined:
@flyinprogrammer
flyinprogrammer / clean.sh
Created Dec 22, 2014
Ubuntu vagrant cleanup script
View clean.sh
#!/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 / jruby_time_bug.md
Created Jun 11, 2013
inverted timezone in jruby?
View jruby_time_bug.md
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
View gist:4490672
#!/usr/bin/env ruby
require 'date'
require 'mongoid'
Mongoid::Config.connect_to("email_test")
class Email
include Mongoid::Document
field :headers
field :received
You can’t perform that action at this time.