Programming language cook book

From Review or Discard at Will
Revision as of 12:41, 1 February 2016 by Jeffa (talk | contribs) (Added firewall)
Jump to: navigation, search

Mostly just for me to remember stuff

I might use a command once, then not again for years. Hopefully I can jog my memory quickly here.

Python

I wanted a json utc datetime for a MQTT payload. Found the arrow module that is much like moment.js for javascript.

import arrow
print (arrow.get(arrow.utcnow()).for_json()

results in: "2015-08-27T15:03:07.427351+00:00" I'd like to trim it further and replace the +00:00 with Z. ??? and less precision on the seconds.

Documentation for ISO 8601

Mediawiki

display unformated like code snippets

<source lang="text"> code snippet </source>

Fedora fc.22

I opened up node.js on port 3000 with this command.

firewall-cmd --permanent --add-port=3000/tcp
# be sure to reload
 firewall-cmd --reload

7-zip

I wanted to create a .zip file for my FDDSE project from the command line. Perhaps in a batch file.

7z a -tzip FDDSE.zip FDDSE

VS 2015 IISExpress

.vs\config\applicationhost.config
%userprofile%\Documents\IISExpress\
netsh http show urlacl
netsh http add urlacl url=http://localhost:60262/ user=everyone
netsh http delete urlacl url=http://*:60262/
I 'ended' Microsoft.VsHub.Server.HttpHostx64.exe with TaskManager
// punch a hole in the firewall
// oopps just noticed I'm running public profile at home on nat. Another toDo
C:\Users\jeffa>netsh advfirewall firewall add rule name="IISExpressWeb" dir=in protocol=tcp localport=60262 profile=private remoteip=localsubnet action=allow
Ok.


C:\Users\jeffa>netsh advfirewall firewall add rule name="IISExpressWeb" dir=in protocol=tcp localport=60262 profile=public remoteip=localsubnet action=allow
Ok.