Skip to content

Instantly share code, notes, and snippets.

kixorz / example.cpp
Created Oct 6, 2015
C++ function pointer example
View example.cpp
//function type declaration
typedef <function return type> * (* <function type name>)( <arg type>, ... ); //don't include variable names
<function type name> func;
func = &<function instance name>;
kixorz / aws_lambda_public_ip.js
Last active Mar 28, 2021
Function retrieving AWS Lambda public IP address. Copy and paste this to your Lambda console, use standard permissions, execute and observe the log to see the public IP address of your Lambda function.
View aws_lambda_public_ip.js
var http = require('http');
exports.handler = function(event, context) {
http.get('', function(res) {
var body = '';
res.on('data', function(chunk) {
body += chunk;
res.on('end', function() {
View cfn_coreos_ecs.json
"Parameters" : {
"KeyName" : {
"Type" : "String",
"Description" : "EC2 KeyPair"
"ClusterName" : {
"Type": "String",
"Description" : "ECS Cluster name"
kixorz / ec2hostname.rb
Last active Dec 5, 2017
EC2 DNS load-balancing init.d script. Instances automatically register themselves in Route53 RecordSets and properly update their records when starting/shutting down. Instances need to use attached IAM role allowing them to modify the Route53 zone.
View ec2hostname.rb
# chkconfig: 35 99 01
# description: EC2 DNS loadbalancing
# processname: ec2hostname
require 'aws-sdk'
require 'net/http'
`touch /var/lock/subsys/ec2hostname`
kixorz / ec2hostname.rb
Last active Apr 11, 2022
EC2 Instance Route53 Hostname registration init.d script. Instance needs to have the attached IAM instance role policy applied.
View ec2hostname.rb
# chkconfig: 35 99 01
# description: EC2 DNS registration
# processname: ec2hostname
require 'aws-sdk'
require 'net/http'
`touch /var/lock/subsys/ec2hostname`
kixorz / INSTALL
Last active Aug 29, 2015
Stackdriver agent setup on Ubuntu Saucy
taken from:
switch to root and:
curl -o /etc/apt/sources.list.d/stackdriver.list
curl --silent | apt-key add -
apt-get update
apt-get install libhiredis0.10
apt-get install stackdriver-agent
View ubuntu-cloudformation.json
"UserData": {
"Fn::Base64": { "Fn::Join":["", [
"#!/bin/bash -ex\n",
"apt-get update\n",
"apt-get -y install python-setuptools\n",
"mkdir aws-cfn-bootstrap-latest\n",
"curl | tar xz -C aws-cfn-bootstrap-latest --strip-components 1\n",
"easy_install aws-cfn-bootstrap-latest\n",
"/usr/local/bin/cfn-init --stack ", { "Ref":"AWS::StackName" }, " --resource WebServer", " --region ", { "Ref": "AWS::Region" }, "\n",
kixorz / test.html
Created Apr 4, 2014
YouTube API experiment
View test.html
<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8" />
<script src=""></script>
<script src=""></script>
<div id="ytapiplayer">You need Flash player 8+ and JavaScript enabled to view this video.</div>
kixorz / node.conf
Created Mar 17, 2014
Node.js Upstart script template
View node.conf
description "<project>"
author "<author>"
env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
start on runlevel [23]
kixorz / auto_logon.reg
Created Mar 5, 2014
Automatic Windows login for selected username.
View auto_logon.reg
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]