Skip to content

Instantly share code, notes, and snippets.

@optionalg
optionalg / RubyNext.tmLanguage
Created November 17, 2017 08:55 — forked from edubkendo/RubyNext.tmLanguage
A better ruby syntax highlighter for sublime text. Combines the ruby bundle with ST, recent updates to the textmate bundle, and a tmLanguage file called "Experimental Ruby".
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>comment</key>
<string>
TODO: unresolved issues
text:
@optionalg
optionalg / Dockerfile
Created November 16, 2017 06:16 — forked from oblank/Dockerfile
nginx php mysql redis memcached mongodb
#vim:set ft=dockerfile:
FROM centos:latest
MAINTAINER oBlank <dyh1919@gmail.com>
# Add the ngix and PHP dependent repository
ADD ./files/nginx.repo /etc/yum.repos.d/nginx.repo
# Installing nginx
RUN yum -y install nginx perl
@optionalg
optionalg / spinnaker-local.yml
Created November 16, 2017 02:08 — forked from viglesiasce/spinnaker-local.yml
Spinnaker local configuration
# This file is intended to override the default configuration in the
# spinnaker.yml file while providing guidance on the mostly likely
# configuration parameters to be changed.
#
# In order for Spinnaker to discover it, it must be copied to a file named
# "spinnaker-local.yml" and placed in the $HOME/.spinnaker directory.
global:
spinnaker:
timezone: 'America/Los_Angeles'
global:
spinnaker:
timezone: 'America/Los_Angeles'
oraclebmcs:
enabled: true
accounts:
- name: bristoldev
compartmentId: 'ocid1.compartment.oc1..aaaaaaaa3um2atybwhder4qttfhgon4j3hcxgmsvnyvx4flfjyewkkwfzwnq'
userId: 'ocid1.user.oc1..aaaaaaaalazktz3vckflmtybfllqxu6zruovinecyglo7ylz5aqrbf4je4bq'
@optionalg
optionalg / start_cig_note.md
Created November 14, 2017 17:45 — forked from xemoe/start_cig_note.md
Setup Collectd + InfluxDB + Grafana

OS: Ubuntu 14.04 amd64

InfluxDB

  1. download deb file http://s3.amazonaws.com/influxdb/influxdb_latest_amd64.deb

  2. install via dpkg -i influxdb_latest_amd64.deb

  3. configure /opt/influxdb/shared/config.toml add input_plugins.collectd below the input_plugins section

    [input_plugins]
    

[input_plugins.collectd]

@optionalg
optionalg / gist:28457aeba1fa63617d4f91b7d749b7aa
Created November 13, 2017 08:28 — forked from pmahoney/gist:1970815
Jenkins and Java fork()+exec() out of memory

Orien is correct, it is the fork() system call triggered by ProcessBuilder or Runtime.exec or other means of the JVM executing an external process (e.g. another JVM running ant, a git command, etc.).

There have been some posts on the Jenkins mailing lists about this: Cannot run program "git" ... error=12, Cannot allocate memory

There is a nice description of the issue on the SCons dev list: fork()+exec() vs posix_spawn()

There is a long standing JVM bug report with solutions: Use posix_spawn, not fork, on S10 to avoid swap exhaustion. But I'm not sure if this actually made it into JDK7 as the comments suggest was the plan.

In summary, on Unix-like systems, when one process (e.g. the JVM) needs to launch another process (e.g. git) a system call is made to

@optionalg
optionalg / ec2tags.rb
Created November 13, 2017 02:17 — forked from rafaelfelix/ec2tags.rb
Hack to get ec2 tags to facter. Depends on aws-cli (https://github.com/aws/aws-cli), jq (http://stedolan.github.io/jq/) and the JSON RubyGem (http://rubygems.org/gems/json)
require 'facter'
require 'json'
if Facter.value("ec2_instance_id") != nil
instance_id = Facter.value("ec2_instance_id")
region = Facter.value("ec2_placement_availability_zone")[0..-2]
tags = Facter::Util::Resolution.exec("aws ec2 describe-tags --filters \"name=resource-id,values=#{instance_id}\" --region #{region} | jq '[.Tags[] | {key: .Key, value: .Value}]'")
parsed_tags = JSON.parse(tags)
parsed_tags.each do |tag|
@optionalg
optionalg / deployment-tool-ansible-puppet-chef-salt.md
Created November 12, 2017 18:48 — forked from jaceklaskowski/deployment-tool-ansible-puppet-chef-salt.md
Choosing a deployment tool - ansible vs puppet vs chef vs salt

Requirements

  • no upfront installation/agents on remote/slave machines - ssh should be enough
  • application components should use third-party software, e.g. HDFS, Spark's cluster, deployed separately
  • configuration templating
  • environment requires/asserts, i.e. we need a JVM in a given version before doing deployment
  • deployment process run from Jenkins

Solution

@optionalg
optionalg / WordRectangle.py
Created November 2, 2017 05:45 — forked from NoahNelson/WordRectangle.py
Python solution to Cracking the Coding Interview Question 17.25 - Word Rectangle
### WordRectangle.py
### Python solution to Cracking the Coding Interview's question 17.25
### Noah Nelson
###
### The problem:
### Given a dictionary or list of words, return the largest rectangle you can
### form out of those words where every row and every column is a valid word.
### All of the rows have to have the same length, and all of the columns,
### but the width and height may be different. The largest rectangle is the
### one with the largest area.
@optionalg
optionalg / TrueColour.md
Created October 31, 2017 12:33 — forked from XVilka/TrueColour.md
True Colour (16 million colours) support in various terminal applications and terminals

Colours in terminal

It's a common confusion about terminal colours... Actually we have this:

  • plain ascii
  • ansi escape codes (16 colour codes with bold/italic and background)
  • 256 colour palette (216 colours + 16 ansi + 24 gray) (colors are 24bit)
  • 24bit true colour ("888" colours (aka 16 milion))
printf "\x1b[${bg};2;${red};${green};${blue}m\n"