Skip to content

Instantly share code, notes, and snippets.

@padi
padi / kill_rubies.sh
Created August 17, 2017 02:46
Script to kill all spring and rogue ruby processes
#!/bin/sh
ps aux | grep ruby | grep -v grep | awk '{print $2}' | xargs kill
@SteveMarshall
SteveMarshall / send-magic-packet.sh
Created April 7, 2017 12:28
Wake-On-Lan Magic Packet using netcat in bash
#!/usr/bin/env bash
mac_address=$1
# Strip colons from the MAC address
mac_address=$(echo $mac_address | sed 's/://g')
broadcast=$2
port=4343
# Magic packets consist of 12*`f` followed by 16 repetitions of the MAC address
@markhowellsmead
markhowellsmead / operatingsystem.js
Last active March 7, 2024 20:57
Detect a device operating system using JavaScript. Windows OS will be more precisely recognized.
if(navigator.appVersion.indexOf("Windows ")!=-1){
os = getWindowsOS();
}else{
os = navigator.platform;
}
function getWindowsOS(){
// http://msdn.microsoft.com/en-us/library/ms537503(v=vs.85).aspx#PltToken
if(navigator.appVersion.indexOf("Windows NT 10.")!=-1){
return 'Windows 10';