View editing-files-in-lxss.md

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
View random_string_using_char_set.rb
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
View one-shot-osc.rb
#!/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
View thenewyorker-email.html
------=_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=
View TeensyBluefriendDemo.ino
/*!
@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.
View OscEsp8266.ino
#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>
View HTTP_loop.ino
/*
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";
View DyanOSC.java
/**
* ##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
View RemoveTwitterTrends.user.js
// ==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++) {
View version.rb
#!/usr/bin/env ruby
require 'fileutils'
if ARGV.empty?
warn "Usage: #{__FILE__} <file-to-version>"
end
f = ARGV.first