Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2008-2013 Edgewall Software
# Copyright (C) 2008 Eli Carter
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.com/license.html.
@mwiemarc
mwiemarc / random-string.js
Created July 1, 2018 22:01 — forked from Dreyer/random-string.js
Generate random alphanumeric string in JavaScript
// @source: http://stackoverflow.com/questions/1349404/generate-a-string-of-5-random-characters-in-javascript
function randomStr(m) {
var m = m || 9; s = '', r = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
for (var i=0; i < m; i++) { s += r.charAt(Math.floor(Math.random()*r.length)); }
return s;
};
@mwiemarc
mwiemarc / Random-string
Created July 1, 2018 21:59 — forked from 6174/Random-string
Generate a random string in JavaScript In a short and fast way!
//http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript
Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
@mwiemarc
mwiemarc / _README.md
Created July 1, 2018 05:00 — forked from morganrallen/_README.md
Janky Browser

JankyBrowser

The only cross-platform browser that fits in a Gist!

One line install. Works on Linux, MacOSX and Windows.

Local Install

$&gt; npm install http://gist.github.com/morganrallen/f07f59802884bcdcad4a/download
@mwiemarc
mwiemarc / datediff.js
Created June 22, 2018 09:38 — forked from remino/datediff.js
JavaScript: DateDiff & DateMeasure: Calculate days, hours, minutes, seconds between two Dates
(function() {
function DateDiff(date1, date2) {
this.days = null;
this.hours = null;
this.minutes = null;
this.seconds = null;
this.date1 = date1;
this.date2 = date2;
@mwiemarc
mwiemarc / msconvert.js
Created June 22, 2018 09:38 — forked from remino/msconvert.js
JavaScript: Convert milliseconds to object with days, hours, minutes, and seconds
function convertMS(ms) {
var d, h, m, s;
s = Math.floor(ms / 1000);
m = Math.floor(s / 60);
s = s % 60;
h = Math.floor(m / 60);
m = m % 60;
d = Math.floor(h / 24);
h = h % 24;
return { d: d, h: h, m: m, s: s };
<!DOCTYPE html>
<html>
<head>
<title>Demo</title>
<style type="text/css">
body{
background-color:#ccc;
padding: 20px;
@mwiemarc
mwiemarc / SimpleHttpServer.cs
Created June 17, 2018 22:26 — forked from augustoproiete/SimpleHttpServer.cs
C# Based HttpListener Static File Web Server
using System;
using System.Collections.Generic;
using System.Net.Sockets;
using System.Net;
using System.IO;
using System.Threading;
using System.Windows.Forms;
using Westwind.Utilities;
namespace Westwind.WebConnection
.row {
display: flex;
flex-wrap: wrap;
margin-left: 0;
margin-right: 0;
}
.row.row-gapless {
margin-left: 0;
margin-right: 0;
// Slightly modified Adalight protocol implementation that uses FastLED
// library (http://fastled.io) for driving WS2811/WS2812 led stripe
// Was tested only with Prismatik software from Lightpack project
#include "FastLED.h"
#define NUM_LEDS 114 // Max LED count
#define LED_PIN 6 // arduino output pin
#define GROUND_PIN 10
#define BRIGHTNESS 255 // maximum brightness