Skip to content

Instantly share code, notes, and snippets.

View nightfly19's full-sized avatar

Sage Imel nightfly19

  • Portland State University
  • Portland, Oregon
View GitHub Profile
@nightfly19
nightfly19 / gist:6216990
Created August 13, 2013 01:22
imapsync stats
++++ Statistics
Transfer started on : Mon Aug 12 18:14:40 2013
Transfer ended on : Mon Aug 12 18:20:19 2013
Transfer time : 338.7 sec
Messages transferred : 543
Messages skipped : 0
Messages found duplicate on host1 : 0
Messages found duplicate on host2 : 0
Messages void (noheader) on host1 : 0
Messages void (noheader) on host2 : 0
app.get(
'/secure',
//What middleware to use here to see if I've already authenticated?
passport.authorize('ldap', { failureFlash: true }),
function(req, res){
res.render('index', {
pageTitle:'something here',
body:'cows mooooo'
});
}
@nightfly19
nightfly19 / gist:6820352
Created October 4, 2013 03:04
reload-file.js
module.exports = function(module){
try{
delete require.cache[require.resolve(module)];
}
catch(err){
console.log(err);
}
//console.log(require.cache);
return require(module);
};
:hierarchy:
- 'fqdn/%{fqdn}'
- 'modules/%{module_name}'
- 'global'
:logger: 'console'
:yaml:
:datadir: '/var/lib/hiera'
:backends:
- 'file'
- 'yaml'
@nightfly19
nightfly19 / gist:7096306
Created October 22, 2013 07:02
Nginx proxying node
upstream node_daemon {
server 127.0.0.1:8080;
}
server {
listen 80;
server_name realhost;
location / {
proxy_pass http://node_daemon;
$cert_path = $::osfamily ? {
'RedHat' => '/etc/pki/tls/certs/cas.pem',
default => fail("osfamily ${osfamily} not supported"),
}
root@scootaloo:/var/log# cat auth.log | cut -b -6 | sort | uniq -c
4631 Mar 10
2097 Mar 11
2780 Mar 12
1584 Mar 13
2520 Mar 14
3782 Mar 9
@nightfly19
nightfly19 / gist:9633761
Last active August 29, 2015 13:57
'Fail's behavior within a selector
# Currently the pattern used when implementing a params class is something like this.
# It works but is very verbose for what it does.
class puppet::params{
# In this case we are only specializing based on one parameter
case $::osfamily {
'Debian': {
$conf_file_path = '/etc/puppet/puppet.conf'
}
default: {
@nightfly19
nightfly19 / subnet_hosts.sql
Last active August 29, 2015 14:01
subnet_hosts
create or replace function subnet_hosts(subnet cidr) returns setof inet as $$
declare
host inet := (inet (host(network(subnet))));
broadcast inet := (inet (host(broadcast(subnet))));
begin
if family(subnet) = 4 then
-- /32's are a special case
if masklen(subnet) = 32 then
return next subnet;
return;
#include <stdio.h>
#include <stdint.h>
int main(int argc, char** argv){
char cow2[5][4];
cow2[3][4] = 10;
cow2[0][0] = 1;
cow2[0][1] = 2;
printf("moo:%i\n", *((char*) cow2+(4*3+4)));
return 0;
}