Skip to content

Instantly share code, notes, and snippets.

View nikmartin's full-sized avatar

Nik Martin nikmartin

View GitHub Profile
@nikmartin
nikmartin / gist:3835175
Created October 4, 2012 17:36
fusion provision
<?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);
?>
@nikmartin
nikmartin / corosync.conf
Created September 26, 2012 13:48
corosync crash
compatibility: whitetank
totem {
version: 2
secauth: off
threads: 0
interface {
ringnumber: 0
bindnetaddr: 172.16.10.0
mcastaddr: 226.94.1.2
@nikmartin
nikmartin / gist:3785046
Created September 25, 2012 23:23
corosync crash
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)
@nikmartin
nikmartin / chkauth.c
Created September 10, 2012 00:26
PAM Auth App
#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;
@nikmartin
nikmartin / updateContacts.js
Last active August 29, 2015 14:26
A short example of how to bulk update a list of Hubspot contacts using node.js and the Hubspot API
/**
hubspot API - how to update a list of contatcs using hubspot API and node.js
The MIT License (MIT)
Copyright (c) 2015 Nik Martin
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
@nikmartin
nikmartin / index.tpl
Created May 8, 2015 15:21
Underscore/Lodash template test
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Underscore/lodash template test </title>
<script data-require="jquery@*" data-semver="2.1.4" src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
<!--whichever one of these is LAST will get assigned to '_'-->
<script data-require="lodash.js@*" data-semver="3.8.0" src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.8.0/lodash.js"></script>
// ==UserScript==
// @name Clean Up Signals notifier.
// @version 0.2
// @include https://api.getsignals.com/*
// @include https://app.getsignals.com/*
// @include chrome-extension://*
// @require //ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js
// ==/UserScript==
var cleanDiv = $(".over-limit-state");
##
## Put me in ~/.irssi/scripts, and then execute the following in irssi:
##
## /load perl
## /script load notify
##
use strict;
use Irssi;
use vars qw($VERSION %IRSSI);
@nikmartin
nikmartin / gist:9004005
Created February 14, 2014 16:18
Node + Express Cache Control
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();
});
@nikmartin
nikmartin / conf.d-myapp.conf
Created February 12, 2014 17:03
Nginx proxy for Node.js App
# HTTPS server
#
server {
listen 80;
return 301 https://$host$request_uri;
}
server {
listen 443;
server_name localhost;