Skip to content

Instantly share code, notes, and snippets.

View duhruh's full-sized avatar
👽
Storming Area 51

David Rivera duhruh

👽
Storming Area 51
View GitHub Profile
@PatrickLang
PatrickLang / README.md
Last active June 10, 2024 18:36
Yubikey + Windows

Using a Yubikey 4 on Windows

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.

//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.
/**
* sails-jwt-auth configuration and devdocs
*
*
*/
/**
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){

A Modest Proposal: Events

Sails.js v0.10

Events are a new feature of the Sails core as of 0.9.

Core events

Lifecycle

@fanzeyi
fanzeyi / scroll.css
Created November 1, 2012 18:34
Google Plus Scroll Style
::-webkit-scrollbar{
height:16px;
overflow:visible;
width:16px;
}
::-webkit-scrollbar-button{
height:0;
width:0;
}
@superdaigo
superdaigo / zabbix-alert-smtp.sh
Created September 20, 2012 04:58
Zabbix SMTP Alert script for gmail
#!/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
@dskanth
dskanth / app.js
Created May 8, 2012 10:56
Server file for Private chat using node.js and socket.io
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');
});
@kanreisa
kanreisa / app.js
Created November 28, 2011 07:14
node.js / socket.io SSL接続サンプル (サーバ, クライアント)
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()
});