Skip to content

Instantly share code, notes, and snippets.

View markandrewj's full-sized avatar

Mark Jackson markandrewj

  • Canada
View GitHub Profile
@DavidJFelix
DavidJFelix / HyperLogLogs_lab.md
Last active December 15, 2023 12:35
A lab for HyperLogLogs using Redis & Python, created with Ipython notebook

Redis is an in-memory network key/value store and nltk is the python natural language toolkit. We'll be using these libraries later for the lab.

    import redis
    import nltk

Setup our redis connection. It's on the VM, so local is fine.

@ddoc
ddoc / rdns.sh
Created January 16, 2014 00:20
rdns creation script for foreman hooks https://github.com/theforeman/foreman_hooks. More information at: http://www.brian2.net/posts/foreman_hooks_aws_vpc/
#!/bin/bash
. /usr/share/foreman/config/hooks.d/lib/utils.sh
. $FOREMAN_HOME/config/hooks.d/lib/hook_functions.sh
set -x
IP=$(hook_data host.ip)
DNSNAME=$(hook_data host.name)
REVERSE=$(reverseIp ${IP})
rdns_create() {
echolog IP ${IP} calling nsupdate: dns3.server.name update add ${REVERSE}.in-addr.arpa. 86400 PTR $DNSNAME
@ayechan
ayechan / itermcolors2putty.rb
Last active July 3, 2018 15:01
A command-line tool converting .itermcolors (color schemes of iTerm2) to putty color entries.
require 'plist'
def conv_color_component(fval)
( 255.0 * fval ) .to_i
end
def conv_color(node)
r = conv_color_component(node['Red Component'])
g = conv_color_component(node['Green Component'])
b = conv_color_component(node['Blue Component'])
@jirutka
jirutka / rules-both.iptables
Created September 18, 2012 12:42
Basic iptables template for ordinary servers (both IPv4 and IPv6)
###############################################################################
# The MIT License
#
# Copyright 2012-2014 Jakub Jirutka <jakub@jirutka.cz>.
#
# 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
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
@Mithrandir0x
Mithrandir0x / gist:3639232
Created September 5, 2012 16:15
Difference between Service, Factory and Provider in AngularJS
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/
// author: Pawel Kozlowski
var myApp = angular.module('myApp', []);
//service style, probably the simplest one
myApp.service('helloWorldFromService', function() {
this.sayHello = function() {
return "Hello, World!"
@btoone
btoone / curl.md
Last active April 2, 2024 20:18
A curl tutorial using GitHub's API

Introduction

An introduction to curl using GitHub's API.

The Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin
# unicorn_rails -c /data/github/current/config/unicorn.rb -E production -D
rails_env = ENV['RAILS_ENV'] || 'production'
# 16 workers and 1 master
worker_processes (rails_env == 'production' ? 16 : 4)
# Load rails+github.git into the master before forking workers
# for super-fast worker spawn times
preload_app true