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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### 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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if manage_repo | |
yumrepo {'repo': | |
enabled => 1, | |
gpgcheck => 1, | |
} | |
end | |
package { 'package': | |
ensure => latest, | |
if Yumrepo['repo'] was defined: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
NewerOlder