Skip to content

Instantly share code, notes, and snippets.

View Neurogami's full-sized avatar

Neurogami Neurogami

View GitHub Profile

Scenario: Wanting to add a virtualhost file to Apache2, which was installed using apt while in bash

Assumption: /etc/apache2 in bash maps to %HOME%\AppData\Local\lxss\rootfs\etc\apache2

  1. Opened a Windows-linux bash shell
  2. Installed apache2 (sudo apt-get install ...)
  3. Wanted to add a virtual host file that had been used on another dev machine
  4. Decided that editing files with vi in the bash terminal was too annoying :)
  5. Found the matching "sites-available" folder via Win10 File Explorer.
  6. Copied an existing virtualhost file itno that folder
def random_string_using_char_set len, chars
(0...len).map { chars[rand(chars.size)] }.join
end
safe_chars = (('A'..'Z').to_a + ('a'..'z').to_a + ('3'..'9').to_a ) - %w{5 S Z l o O}
some_string = random_string_using_char_set 50, safe_chars
p some_string
#!/usr/bin/env ruby
require 'osc-ruby-ng'
if ARGV.empty?
puts "Usage: #{__FILE__} <adddress>:<port> <address_pattern> [args ...]"
exit
end
def arg_to_type a
------=_Part_19856_1401403311.1448656482155
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org=
/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns=3D"http://www.w3.org/1999/xhtml">
<head><meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DUTF=
-8"><meta name=3D"format-detection" content=3D"telephone=3Dno"><meta name=
/*!
@file bleuart_datamode.ino
@author hathach, ktown (Adafruit Industries)
This demo will show you how to initialize the module in COMMAND mode then
send data in DATA mode, uses the MODE pin
Altered to work with a Teensy 3.1 using Serial2
The Bluefruit CTS pin is connected to Teensy pin 8.
@Neurogami
Neurogami / OscEsp8266.ino
Created September 29, 2015 04:56
Simple OSC lop using ESP8266 and Arduino IDE
#include <OSCMessage.h>
#include <WiFiUdp.h>
WiFiUDP Udp; // A UDP instance to let us send and receive packets over UDP
const IPAddress outIp(192,168,0,99); // remote IP of your computer
const unsigned int outPort = 9900; // remote port to receive OSC
const unsigned int localPort = 9901; // local port to listen for OSC packets (actually not used for sending)
#include <ESP8266WiFi.h>
@Neurogami
Neurogami / HTTP_loop.ino
Created September 29, 2015 04:38
Simple sketch for the ESP8266 using the Arduino IDE
/*
This sketch sends data via HTTP GET requests to an IP address.
*/
#include <ESP8266WiFi.h>
const char* ssid = "YOUR_WIFI_SSID";
const char* password = "YOUR_WIFI_PASSWORD";
/**
* ##library.name##
* ##library.sentence##
* ##library.url##
*
* Copyright James Britt / Neurogami
*
* The MIT License (MIT)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
// ==UserScript==
// @name Remove Twitter Trends and Recommendations
// @namespace neurogami.com
// @description Removes Twitter Trends and "who to Follow" from the Sidebar. Works, as of 10/22/12
// @include http://twitter.com/*
// @include https://twitter.com/*
// ==/UserScript==
window.setTimeout(function() {var evilDiv, thisDiv;
evilDiv = document.evaluate("//div[@data-component-term='user_recommendations']", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for (var i = 0; i < evilDiv.snapshotLength; i++) {
#!/usr/bin/env ruby
require 'fileutils'
if ARGV.empty?
warn "Usage: #{__FILE__} <file-to-version>"
end
f = ARGV.first