Skip to content

Instantly share code, notes, and snippets.

@jwmickey
jwmickey / test.json
Created July 30, 2020 01:48
testing editing json within github
{
"hello": "world",
"array": [
1, 2, 3
],
"object": {
"foo": "bar"
}
}
Vue.component('spec', {
props: ['code', 'default'],
inject: ['$getSettings'],
computed: {
// details of this are irrelavent to vue, we're just figuring out what to display
getText() {
const settings = this.$getSettings();
if (!settings.hasOwnProperty(this.code)) {
return this.default;
}
@jwmickey
jwmickey / to_redis_proto.go
Created August 19, 2019 18:59
Generate Redis Protocol
func genRedisProto(c chan string, cmd ...string) {
proto := fmt.Sprintf("*%v\r\n", len(cmd))
for _, word := range cmd {
proto = proto + fmt.Sprintf("$%v\r\n", len(word))
proto = proto + word + "\r\n"
}
c <- proto
}
func main() {
@jwmickey
jwmickey / docker-copy-data.sh
Created August 2, 2019 18:35
[Docker] Copy data from host to existing volume
# mount on a specific volume
docker run -v my-jenkins-volume:/data --name helper busybox true
docker cp . helper:/data
docker rm helper
# alternatively, mount on volumes from another container
docker run --volumes-from my_other_container --name helper busybox true
# ...

Keybase proof

I hereby claim:

  • I am jwmickey on github.
  • I am jodymickey (https://keybase.io/jodymickey) on keybase.
  • I have a public key ASDce0_N-GsqIYtqMMivbMTjwl9HmUxvNJpBiHHHSJUJvwo

To claim this, I am signing this object:

#!/usr/bin/python
# simple command to wake on lan a host from a predefined list of presets.
# requires wakeonlan package to be installed
from wakeonlan import wol
import sys
if len(sys.argv) < 2:
print "Usage: %s <hostname>" % (sys.argv[0])
@jwmickey
jwmickey / check-connection.py
Created January 12, 2015 18:53
Python script to notify via email when connection resumes
"""
This script determines if your internet connection is up by attempting to open a connection to a specified host.
You can also provide the 'notify' command and an email address to continually monitor for a resumed connection.
I use this specifically to send myself a text in the case where my home connection is out and I went to a coffee
shop, library, etc. in the meantime.
Disclaimer: I'm a python n00b so I'm sure there are better/simpler ways to do this.
License: MIT
"""