Skip to content

Instantly share code, notes, and snippets.

View shanemcd's full-sized avatar

Shane McDonald shanemcd

  • (Ansible (Red Hat (IBM)))
  • Jersey City
View GitHub Profile
@shanemcd
shanemcd / scratch_server.go
Created July 15, 2023 20:10 — forked from jschaf/scratch_server.go
A Go web server from scratch using syscalls
package main
// Simple, single-threaded server using system calls instead of the net library.
//
// Omitted features from the go net package:
//
// - TLS
// - Most error checking
// - Only supports bodies that close, no persistent or chunked connections
// - Redirects
@shanemcd
shanemcd / Dockerfile
Created April 19, 2018 16:43
Example showing how to run a Node Server using the Node SCL
FROM centos:7
RUN yum install -y centos-release-scl-rh
RUN yum-config-manager --enable rhel-server-rhscl-7-rpms
RUN yum install -y scl-utils rh-nodejs8
RUN curl -Lo app.js https://gist.githubusercontent.com/conifertw/3719759/raw/9031d13eef36686f39b1e453dfc6529064cbaf61/gistfile1.js
RUN sed -i 's/127.0.0.1/0.0.0.0/g' app.js
Mock Version: 1.3.4
ENTER ['do'](['bash', '--login', '-c', '/usr/bin/rpmbuild -bs --target x86_64 --nodeps /builddir/build/SPECS/erlang.spec'], shell=FalseprintOutput=FalsechrootPath='/var/lib/mock/epel-7-x86_64-mockbuilder-6128/root'nspawn_args=[]uid=1001gid=135timeout=0logger=<mockbuild.trace_decorator.getLog object at 0x7f2b6df2d828>user='mockbuild'env={'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'PS1': '<mock-chroot> \\s-\\v\\$ ', 'SHELL': '/bin/bash', 'PROMPT_COMMAND': 'printf "\\033]0;<mock-chroot>\\007"', 'TERM': 'vt100', 'LANG': 'en_US.UTF-8', 'HOME': '/builddir', 'HOSTNAME': 'mock'})
Executing command: ['bash', '--login', '-c', '/usr/bin/rpmbuild -bs --target x86_64 --nodeps /builddir/build/SPECS/erlang.spec'] with env {'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'PS1': '<mock-chroot> \\s-\\v\\$ ', 'SHELL': '/bin/bash', 'PROMPT_COMMAND': 'printf "\\033]0;<mock-chroot>\\007"', 'TERM': 'vt100', 'LANG': 'en_US.UTF-8', 'HOME': '/builddir', 'HOSTNAME': 'mock'} and shell False
warning: bogus date in %changelog:
@shanemcd
shanemcd / etc.fstab
Last active December 4, 2016 18:40 — forked from vadviktor/etc.fstab
Ubuntu guest VMware shared folders using open-vm-tools package and vmhgfs-fuse
.host: /mnt fuse.vmhgfs-fuse allow_other,uid=1000,gid=1000,auto_unmount,defaults 0 0

Keybase proof

I hereby claim:

  • I am shanemcd on github.
  • I am shanemcd (https://keybase.io/shanemcd) on keybase.
  • I have a public key whose fingerprint is C0D6 7E46 E506 8B11 6212 1457 5DF2 ED93 B72A C963

To claim this, I am signing this object:

require 'rubygems'
require 'doc_raptor'
TEN_SECONDS = 10
FIVE_MINUTES = 300
DocRaptor.api_key "YOUR_API_KEY_HERE"
pdf_html = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html lang="en"><body><a href="http://google.com">google</a></body></html>'
# routes.rb
get '/:campaign' => 'campaigns#show', constraints: CampaignConstraint.new
# lib/campaign_constraint.rb
class CampaignConstraint
def matches?(request)
Campaign.exists?(name: request.params[:campaign])
end
end
@mixin background-image-retina($file, $type, $width, $background-repeat: no-repeat) {
background-image: image-url($file + '.' + $type);
width: $width;
background-repeat: $background-repeat;
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 144dpi) {
& {
background-image: image-url($file + '@2x.' + $type);
background-size: $width;
}
@shanemcd
shanemcd / gist:5535944
Last active December 17, 2015 02:29
Best Clearfix
.clearfix {
zoom: 1;
clear: both;
}
.clearfix:before, .clearfix:after {
content: "\0020";
display: block;
height: 0;
overflow: hidden;
function pkill() {
for X in `ps acx | grep -i $1 | awk {'print $1'}`; do
kill $X;
done
}