Skip to content

Instantly share code, notes, and snippets.

View sawanoboly's full-sized avatar
🤷‍♂️
🙃

Yukihiko SAWANOBORI sawanoboly

🤷‍♂️
🙃
View GitHub Profile
@sawanoboly
sawanoboly / file10.diff
Last active December 17, 2015 09:49
RubyでGithubに公開されているOSSのバージョン間差分を表示する ref: http://qiita.com/sawanoboly/items/0b761eacb827bab6d97c
--- a/web/concrete/core/controllers/single_pages/dashboard/pages/types/add.php
+++ b/web/concrete/core/controllers/single_pages/dashboard/pages/types/add.php
@@ -23,8 +23,8 @@ class Concrete5_Controller_Dashboard_Pages_Types_Add extends DashboardBaseContro
if (!$ctName) {
$this->error->add(t("Name required."));
- } else if (preg_match('/[^0-9A-Z\.\!\&\(\)\-\_ ]/i', $ctName)) {
- $this->error->add(t('Page type names can only contain letters, numbers, spaces and the following symbols: !, &, (, ), -, _.'));
+ } else if (preg_match('/[<>{};?"`]/i', $ctName)) {
+ $this->error->add(t('Invalid characters in page type name.'));
@sawanoboly
sawanoboly / opsworks_stack_state.rb
Created April 11, 2013 03:46
Ohai Plugin for AWS OpsWorks
provides 'opsworks'
require 'mixlib/shellout'
require 'json'
unless opsworks
opsworks Mash.new
cmd = Mixlib::ShellOut.new("opsworks-agent-cli stack_state")
GEM
remote: http://rubygems.org/
specs:
activesupport (3.2.12)
i18n (~> 0.6)
multi_json (~> 1.0)
addressable (2.3.3)
archive-tar-minitar (0.5.2)
berkshelf (1.2.1)
activesupport
@sawanoboly
sawanoboly / user-script.sh
Last active December 15, 2015 15:29
Continuous convergence with the chef-solo on the joyent smartmachine.
#!/usr/bin/bash
# REPLACE APP_REPO and APP_NAME
set -e
set -x
export PATH=/opt/local/bin:/opt/local/sbin:/usr/bin:/usr/sbin
MDATA_WRAPPER=001
@sawanoboly
sawanoboly / auto_install_httpfs.sh
Last active December 11, 2015 14:58
Install script Cloudera HttpFS for joyentcloud dataset "hadoop-1.0.0"
#!/usr/bin/bash
## for dataset 'hadoop' 1.0.0
set -e
## httpfs build
pkgin -y install apache-mavenpkgin -y install scmgit
pkgin -y install sun-jdk6
ln -s /opt/local/java/sun6/lib /opt/local/java/
@sawanoboly
sawanoboly / sm-summary_json
Last active December 11, 2015 05:29
formatted sm-summary output as JSON.
#!/usr/bin/bash
#
# Provides SmartMachine summary of information.
# Joyent 2012.
# JSON OPTION Author: github_id:sawanoboly
PATH="/opt/local/bin:/opt/local/gnu/bin:/opt/local/sbin:/usr/bin:/usr/sbin";
JSON=0
OPT=
@sawanoboly
sawanoboly / m_monit_reporter.rb
Created December 14, 2012 05:41
Create report from M/Monit
#!/usr/bin/env ruby
require 'json'
require 'faraday'
class MonitReports
def initialize(mmonit = "http://127.0.0.1:8080")
@connection = Faraday.new(:url => mmonit)
res = @connection.get "/index.csp"
@cookie = res.headers['set-cookie']
@sawanoboly
sawanoboly / ohai_to_attributes.rb
Created November 1, 2012 04:30
Convert ohai output(json) to cookbook attributes format.
def _out(k,hash)
hash.each_pair do |k2,v2|
str = [k,"['#{k2}']"].join
ha = {str => v2}
out ha
end
end
def out(hash)
hash.each_pair do |k,v|
@sawanoboly
sawanoboly / .mongorc.js
Created October 15, 2012 05:08
mongorc.js: prompt with serverrole(mongos/config/replican-ode or single) and version.
prompt = function() {
// set version
version = db.version();
// case mongos
if (rs.status().info == 'mongos') {
return rs.status().info + ':[' + version + '] > ';
}
// config or replica
@sawanoboly
sawanoboly / Vagrantfile
Created October 3, 2012 12:10
Create GlusterFS clusteredVolume for Vagrant
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
vmbox = "precise64"
vmboxurl = "http://files.vagrantup.com/precise64.box"
gluster_repo = "http://download.gluster.org/pub/gluster/glusterfs/LATEST/Ubuntu/12.04/glusterfs_3.3.0-1_amd64.deb"
gluster_file = "glusterfs_3.3.0-1_amd64.deb"