Skip to content

Instantly share code, notes, and snippets.

View hartsock's full-sized avatar

Shawn Hartsock hartsock

View GitHub Profile
@hartsock
hartsock / sshd.go
Created August 14, 2019 17:07 — forked from jpillora/sshd.go
Go SSH server complete example - Read more here https://blog.gopheracademy.com/go-and-ssh/
// A small SSH daemon providing bash sessions
//
// Server:
// cd my/new/dir/
// #generate server keypair
// ssh-keygen -t rsa
// go get -v .
// go run sshd.go
//
// Client:
@hartsock
hartsock / gist:9199a1382423fa46305d92d74b0d5838
Created August 14, 2019 16:42 — forked from devinodaniel/gist:8f9b8a4f31573f428f29ec0e884e6673
Generate SSH RSA Private/Public Key pair with Golang
// This shows an example of how to generate a SSH RSA Private/Public key pair and save it locally
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"encoding/pem"
"golang.org/x/crypto/ssh"
# How to create an RPM repository
# This is for Redhat 64 bit versions of Linux. You can create your own RPM repository # to host your custom RPM packages.
#
# See "How to create an RPM from source with spec file" for more information.
# https://gist.github.com/1376973
# Step: 1
# Install createrepo
@hartsock
hartsock / AbstractResource.java
Created February 18, 2016 15:32 — forked from knutwalker/AbstractResource.java
Jersey2 + Swagger with Resource inheritance
package com.example;
import com.wordnik.swagger.annotations.ApiParam;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
@hartsock
hartsock / ding.sh
Last active August 29, 2015 14:24 — forked from benpickles/ding.sh
# .___.__
# __| _/|__| ____ ____
# / __ | | |/ \ / ___\
# / /_/ | | | | \/ /_/ >
# \____ | |__|___| /\___ /
# \/ \//_____/
#
# Make a "ding" sound on your Mac! Useful for notifying you when a command
# line script has finished.
#
package com.neolitec.examples;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@hartsock
hartsock / rdhcpd.rb
Last active August 29, 2015 14:08 — forked from telamon/rdhcpd.rb
' Copyright (c) 2007, Tony Ivanov
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
%if 0%{?fedora}
%global _with_python3 1
%endif
%if 0%{?rhel} && 0%{?rhel} <= 6
%{!?__python2: %global __python2 /usr/bin/python2}
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%endif
// Create the updated device spec
VirtualDeviceConfigSpec nicSpec = new VirtualDeviceConfigSpec()
nicSpec.device = nic
nicSpec.operation = VirtualDeviceConfigSpecOperation.edit
// Create the VM update spec
VirtualMachineConfigSpec spec = new VirtualMachineConfigSpec()
spec.deviceChange = [nicSpec]
// Do the update