Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000| #!/bin/sh | |
| ### | |
| # SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer) | |
| # For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos | |
| ### | |
| # Alot of these configs have been taken from the various places | |
| # on the web, most from here | |
| # https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx |
| // Vertical gradient using CSS where possible, and base64-encoded SVG for IE9 (enables use of this in combination with border-radius) | |
| // Based on this by Phil Brown: http://blog.philipbrown.id.au/2012/09/base64-encoded-svg-gradient-backgrounds-in-less/ | |
| // Also based on a mixin from Twitter Bootstrap: https://github.com/twitter/bootstrap | |
| .gradient-vertical(@startColor, @endColor) { | |
| // IE9 prep | |
| @dataPrefix: ~"url(data:image/svg+xml;base64,"; | |
| @dataSuffix: ~")"; | |
| @dataContent: ~'<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 1 1" preserveAspectRatio="none"><linearGradient id="g743" gradientUnits="userSpaceOnUse" x1="0%" y1="0%" x2="0%" y2="100%"><stop stop-color="@{startColor}" offset="0"/><stop stop-color="@{endColor}" offset="1"/></linearGradient><rect x="0" y="0" width="1" height="1" fill="url(#g743)"/></svg>'; |
| cd /usr/local/src | |
| curl -O http://lynx.isc.org/lynx2.8.7/lynx2.8.7.tar.gz | |
| tar -xzvf lynx2.8.7.tar.gz | |
| cd lynx2-8-7 | |
| ./configure --mandir=/usr/share/man | |
| make | |
| sudo make install |
| var os = require("os"); | |
| //Create function to get CPU information | |
| function cpuAverage() { | |
| //Initialise sum of idle and time of cores and fetch CPU info | |
| var totalIdle = 0, totalTick = 0; | |
| var cpus = os.cpus(); | |
| //Loop through CPU cores |
| // 32 bit FNV-1a hash | |
| // Ref.: http://isthe.com/chongo/tech/comp/fnv/ | |
| function fnv32a( str ) | |
| { | |
| var FNV1_32A_INIT = 0x811c9dc5; | |
| var hval = FNV1_32A_INIT; | |
| for ( var i = 0; i < str.length; ++i ) | |
| { | |
| hval ^= str.charCodeAt(i); | |
| hval += (hval << 1) + (hval << 4) + (hval << 7) + (hval << 8) + (hval << 24); |
| /** @jsx React.DOM */ | |
| var MyComponent = React.createClass({ | |
| render: function() { | |
| // Defaults in case the props are undefined. We'll have a solution for this | |
| // soon that is less awkward. | |
| var perMinute = this.props.perMinute || '-'; | |
| var perDay = this.props.perDay || '-'; | |
| return ( | |
| <div> | |
| <h3>Clickouts</h3> |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000| /* | |
| In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp | |
| server, but for some reason omit a client connecting to it. I added an | |
| example at the bottom. | |
| Save the following server in example.js: | |
| */ | |
| var net = require('net'); |
| # A simple Makefile alternative to using Grunt for your static asset compilation | |
| # | |
| ## Usage | |
| # | |
| # $ npm install | |
| # | |
| # And then you can run various commands: | |
| # | |
| # $ make # compile files that need compiling | |
| # $ make clean all # remove target files and recompile from scratch |