This file contains 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
#include <security/pam_appl.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
struct pam_response *reply; | |
int null_conv(int num_msg, const struct pam_message **msg, struct pam_response **resp, void *appdata_ptr) { | |
*resp = reply; |
This file contains 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
valgrind corosync -f | |
==2796== Memcheck, a memory error detector | |
==2796== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al. | |
==2796== Using Valgrind-3.6.0 and LibVEX; rerun with -h for copyright info | |
==2796== Command: corosync -f | |
==2796== | |
==2796== Invalid write of size 2 | |
==2796== at 0x4E35F1A: totemip_parse (in /usr/lib64/libtotem_pg.so.4.0.0) | |
==2796== by 0x40B36E: totem_config_read (in /usr/sbin/corosync) | |
==2796== by 0x40674D: main (in /usr/sbin/corosync) |
This file contains 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
compatibility: whitetank | |
totem { | |
version: 2 | |
secauth: off | |
threads: 0 | |
interface { | |
ringnumber: 0 | |
bindnetaddr: 172.16.10.0 | |
mcastaddr: 226.94.1.2 |
This file contains 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
<?php | |
$fh = fopen("/var/www/fusionpbx/aastra/nik.foo","w") or die("Unable to write. Make sure the path exists and permissons are set correctly."); | |
fwrite($fh, "shit on my driveway again, butthole"); | |
fclose($fh); | |
?> |
This file contains 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
{"posts":[ | |
{ "title": "title1", "date": "03-21-2013" }, | |
{ "title": "title2", "date": "03-21-2013" }, | |
{ "title": "title3", "date": "03-21-2013" }, | |
{ "title": "title4", "date": "03-21-2013" }] | |
} |
This file contains 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
Secure sessions are easy, but not very well documented. | |
Here's a recipe for secure sessions in Node.js when NginX is used as an SSL proxy: | |
The desired configuration for using NginX as an SSL proxy is to offload SSL processing | |
and to put a hardened web server in front of your Node.js application, like: | |
[NODE.JS APP] <- HTTP -> [NginX] <- HTTPS -> [PUBLIC INTERNET] <-> [CLIENT] | |
Edit for express 4.X and >: Express no longer uses Connect as its middleware framework, it implements its own now. |
This file contains 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
1. Create a directory, and cd to it: | |
~/myserver> mkdir myserver && cd myserver | |
2. install send: | |
~/myserver> npm install send | |
3. Create your server: | |
~/myserver> cat > server.js << EOF | |
"use strict"; | |
var http = require('http'), | |
send = require('send'), |
This file contains 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
"use strict"; | |
module.exports = function () { | |
return function (req, res, next) { | |
//do stuff here | |
debug("NEEEXT!"); | |
return res.end(); |
This file contains 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
# HTTPS server | |
# | |
server { | |
listen 80; | |
return 301 https://$host$request_uri; | |
} | |
server { | |
listen 443; | |
server_name localhost; |
This file contains 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 ONE_DAY = 86400000; | |
app.use(function (req, res, next) { | |
res.setHeader('Expires', new Date(Date.now() + ONE_DAY).toUTCString()); | |
res.header('X-powered-by', 'Super Awesome Server'); | |
next(); | |
}); |
OlderNewer