Skip to content

Instantly share code, notes, and snippets.

View fujin's full-sized avatar

AJ Christensen fujin

  • Rotorua, New Zealand
View GitHub Profile
#!/bin/sh
PORT=4200
sudo launchctl unload /Library/LaunchDaemons/com.crashplan.engine.plist
sudo sed -i '' "s/\(<servicePort>\)[^<]*/\1$PORT/" /Library/Application\ Support/CrashPlan/conf/my.service.xml
sed -i '' "s/#*\(servicePort=\).*/\1$PORT/" /Applications/CrashPlan.app/Contents/Resources/Java/conf/ui.properties
defaults write /Applications/CrashPlan.app/Contents/Resources/CrashPlan\ menu\ bar.app/Contents/Info CPPort $PORT
sudo launchctl load /Library/LaunchDaemons/com.crashplan.engine.plist
@fujin
fujin / s3.py
Created April 16, 2014 03:56 — forked from coderanger/s3.py
#!/usr/bin/python
#
# Author:: Noah Kantrowitz <noah@coderanger.net>
#
# Copyright 2013-2014, Balanced, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
@fujin
fujin / ruby.el
Created March 15, 2013 22:36 — forked from chrisroberts/gist:5173018
Fix the fucking indentation rules for ruby-mode
(setq ruby-deep-indent-paren nil)
(defadvice ruby-indent-line (after unindent-closing-paren activate)
(let ((column (current-column))
indent offset)
(save-excursion
(back-to-indentation)
(let ((state (syntax-ppss)))
(setq offset (- column (current-column)))
(when (and (eq (char-after) ?\))
(not (zerop (car state))))
@fujin
fujin / README.md
Last active July 5, 2019 19:31 — forked from agnoster/README.md

agnoster.zsh-theme

A ZSH theme optimized for people who use:

  • Solarized
  • Git
  • Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)

For Mac users, I highly recommend iTerm 2 + Solarized Dark

#!/bin/bash
# herein we backup our indexes! this script should run at like 6pm or something, after logstash
# rotates to a new ES index and theres no new data coming in to the old one. we grab metadatas,
# compress the data files, create a restore script, and push it all up to S3.
TODAY=`date +"%Y.%m.%d"`
INDEXNAME="logstash-$TODAY" # this had better match the index name in ES
INDEXDIR="/usr/local/elasticsearch/data/logstash/nodes/0/indices/"
BACKUPCMD="/usr/local/backupTools/s3cmd --config=/usr/local/backupTools/s3cfg put"
BACKUPDIR="/mnt/es-backups/"
YEARMONTH=`date +"%Y-%m"`
@fujin
fujin / two_factor_ssh.rb
Created June 5, 2012 04:46 — forked from moomerman/two_factor_ssh.rb
Two Factor SSH Authentication
#!/usr/bin/env ruby
require 'rubygems'
require 'rotp'
require 'time'
user = ARGV[0]
secret = ARGV[1]
abort unless user and secret
trap("INT") do
bash 'install science app' do
installed_version_file = "#{app[:base_dir]}/.#{app[:version]}-installed"
cwd Chef::Config[:file_cache_path]
code <<-BASH
tar zxf #{app[:tarball]} -C #{app[:deploy_to]}
cp #{app[:tarball]} #{app[:deploy_to]}
touch #{installed_version_file}
BASH
not_if { ::File.exist?(installed_version_file) }
end
@fujin
fujin / default.rb
Created February 21, 2012 22:54 — forked from jordandm/gist:1879612
Revised side-wise install recipe
#
# Cookbook Name:: awsclient
#
include_recipe "aws"
# Removing dependency on api, do not believe it is required.
# include_recipe "apt"
packages = value_for_platform( "centos" => { "default" => %w[libxml2 libxml2-devel libxslt-devel] } )
@fujin
fujin / windows.rb
Created February 6, 2012 20:43
My snmpd cookbook for windows
windows_feature "SNMP" do
action :install
end
windows_feature "WMISnmpProvider" do
action :install
end
# setup some variables
#
@fujin
fujin / Error
Created February 6, 2012 20:20
Passing args to a handler
[Mon, 06 Feb 2012 19:59:35 +0000] INFO: Processing chef_handler[Medidata::RunLoggerHandler] action enable (mdsol_oq::default line 60)
[Mon, 06 Feb 2012 19:59:35 +0000] ERROR: chef_handler[Medidata::RunLoggerHandler] (mdsol_oq::default line 60) has had an error
[Mon, 06 Feb 2012 19:59:35 +0000] ERROR: chef_handler[Medidata::RunLoggerHandler] (/var/cache/chef/cookbooks/mdsol_oq/recipes/default.rb:60:in `from_file') had an error:
chef_handler[Medidata::RunLoggerHandler] (mdsol_oq::default line 60) had an error: wrong number of arguments (1 for 0)
/var/chef/handlers/runlogger.rb:7:in `initialize'
/var/cache/chef/cookbooks/chef_handler/providers/default.rb:24:in `new'
/var/cache/chef/cookbooks/chef_handler/providers/default.rb:24:in `block in class_from_file'