Events are a new feature of the Sails core as of 0.9.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var PORT = 10443; | |
var SSL_KEY = '___.key'; | |
var SSL_CERT= '___.cert'; | |
var fs = require('fs'); | |
var io = require('socket.io').listen(PORT, { | |
key : fs.readFileSync(SSL_KEY).toString(), | |
cert : fs.readFileSync(SSL_CERT).toString() | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var app = require('express').createServer() | |
var io = require('socket.io').listen(app); | |
var fs = require('fs'); | |
app.listen(8008); | |
// routing | |
app.get('/', function (req, res) { | |
res.sendfile(__dirname + '/chat.html'); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
""" | |
Zabbix SMTP Alert script for gmail. | |
""" | |
import sys | |
import smtplib | |
from email.MIMEText import MIMEText | |
from email.Header import Header |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
::-webkit-scrollbar{ | |
height:16px; | |
overflow:visible; | |
width:16px; | |
} | |
::-webkit-scrollbar-button{ | |
height:0; | |
width:0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
authenticate : function(req,res){ | |
var username = req.param('username') | |
var password = req.param('password') | |
if(!username || !password){ | |
return res.json(403,{err : 'username and password required'}) | |
} | |
User.findOneByUsername(username,function(err,user){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* sails-jwt-auth configuration and devdocs | |
* | |
* | |
*/ | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//issue a token, with an expiration date | |
var jwt = require('jsonwebtoken') | |
//issue token that expires after 10 mins AND has an issuer | |
var token = jwt.sign('helloworld','secret',{ expiresInMinutes : 10, issuer : 'hipster.io'}); | |
//verify token, but don't check assertions. |
These are my notes on how to set up GPG with the private key stored on the hardware Yubikey. This will reduce the chances of your GPG private key from being stolen, and also allow you to protect other secrets such as SSH private keys.
It's just some notes and a partial worklog for now, but I may turn it into a full blog post later.