Skip to content

Instantly share code, notes, and snippets.

@pyxze
pyxze / lcd.ino
Last active February 27, 2017 21:04
// This is for the OSEPP 16x2 Arduino LCD Shield
// Also need the library from https://osepp.com/downloads/LCDKeypad.zip
// include the library code:
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
//LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<ValidateStudentResponse xmlns="http://www.trec.state.tx.us/ProcessRoster">
<ValidateStudentResult>
<xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:msprop="urn:schemas-microsoft-com:xml-msprop">
<xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="Table">
@pyxze
pyxze / js201607.md
Last active January 13, 2017 19:00
JavaScript Libraries, July 2016

Preface

To provide a modern web experience to our users, we need to adopt a JavaScript library. I am currently trying to decide between Vue.js and React. Both are libraries rather than frameworks, which can easily be integrated into existing pages. Vue.js is easy to pick up, uses a familiar CSS/HTML/JS structure, and does not lean towards newer JavaScript variations, but it is very new, maintained by one person, and still relatively unknown. React has a difficult learning curve, leans towards EcmaScript 2016, and encourages users to put everything, including CSS and HTML, into their JavaScript code, but it is the current leader, has a robust ecosystem and tool kit, and is backed by Facebook.

Angular (and Ember) are frameworks that are intended more for websites that are built as Single Page Applications. Meteor is a complete web stack that uses NodeJS for its backend. Thus, neither of these are applicable for our needs.

Background

@pyxze
pyxze / GetLinesFromClipboard.cs
Last active January 4, 2017 18:57
C# Method to Get Lines from Clipboard
public static string[] GetLinesFromClipboard()
{
return Clipboard.GetText().Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
}
# This script was written to facilitate listing files
# for easy removal. It parses the output of find so
# that the files are all listed in date sorted order.
# from http://stackoverflow.com/questions/1094841/reusable-library-to-get-human-readable-version-of-file-size
def sizeof_fmt(num):
for x in ['bytes','KB','MB','GB']:
if num < 1024.0 and num > -1024.0:
return "%3.1f%s" % (num, x)
num /= 1024.0
@pyxze
pyxze / datatablesParser.js
Created October 25, 2013 21:15
JavaScript function I wrote to parse "and" and "or" into proper regex for use with Datatables.
// QUnit tests.
// test("datatables parser", function() {
// equal(datatablesParser("austin"), "austin");
// equal(datatablesParser("houston or austin"), "houston|austin");
// equal(datatablesParser("houston and austin or dallas"), "^(?=.*?\\bhouston\\b)(?=.*?\\baustin\\b).*$|^(?=.*?\\bdallas\\b).*$");
// equal(datatablesParser("houston and austin or dallas and austin"), "^(?=.*?\\bhouston\\b)(?=.*?\\baustin\\b).*$|^(?=.*?\\bdallas\\b)(?=.*?\\baustin\\b).*$");
// equal(datatablesParser("houston or austin or dallas"), "houston|austin|dallas");
// });
@pyxze
pyxze / wut.py
Created October 16, 2013 01:17
WordPress utility script
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
print "1. Update WordPress password."
print "2. Update WordPress site and home URLs."
print "3. Disable plugins."
print "4. Reset theme."
choice = raw_input("What would you like to do? ")
import re
f = open("wp-config.php")
function qme() {
if ($(".subject:last").text() == "realfunny") {
if ($(".text:last").text() == " was kindly escorted off the stage by Beavis bot.") {
$('.message-input').val('q+');
$('.message-input').submit();
}
}
}
$('.messages').unbind("DOMNodeInserted", qme).bind("DOMNodeInserted", qme);