Skip to content

Instantly share code, notes, and snippets.

View wok's full-sized avatar

Wolfgang Kölbl wok

View GitHub Profile
@wok
wok / multi_statements_mysql2.rb
Created November 15, 2011 19:02
ActiveRecord MULTI_STATEMENTS with mysql2
# place in config/initalizers
module ActiveRecord
class Base
# Establishes a connection to the database that's used by all Active Record objects.
def self.mysql2_connection(config)
config[:username] = 'root' if config[:username].nil?
if Mysql2::Client.const_defined? :FOUND_ROWS
config[:flags] = Mysql2::Client::FOUND_ROWS | Mysql2::Client::MULTI_STATEMENTS
@wok
wok / mydbr_include.htm
Created December 2, 2011 12:23
include Mydbr in web page
<object data="http://mydbr.com/demo/mydbr/report.php?r=44&amp;m=1&amp;h=448a73df6c5249b6605f8560e3880e0e754972e4"
type="text/html"
height="500px"
width="100%">
</object>
@wok
wok / index.html
Last active December 14, 2015 06:09
select2 - jQuery UI 1.10
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="http://code.jquery.com/ui/1.10.1/jquery-ui.js"></script>
<script src="select2.js"></script>
<link rel="stylesheet" type="text/css" href="http://code.jquery.com/ui/1.10.1/themes/base/jquery-ui.css"/>
<link rel="stylesheet" type="text/css" href="select2.css"/>
<style type="text/css">
select { width: 300px; }
Pod::Spec.new do |s|
s.name = 'Countly'
s.version = '1.0.0-master'
s.license = {
:type => 'COMMUNITY',
:text => <<-LICENSE
COUNTLY MOBILE ANALYTICS COMMUNITY EDITION LICENSE
--------------------------------------------------
Copyright (c) 2012, 2013 Countly
var char = '',
morseToChar = {
'.-': 'a',
'-...': 'b',
'-.-.': 'c',
'-..': 'd',
'.': 'e',
'..-.': 'f',
'--.': 'g',
'....': 'h',
{
"type": "email",
"customer": {
"email": "customer@example.com",
"firstName": "Jack",
"lastName": "Test 2"
},
"subject": "I need help #17",
"mailbox": {
"id": 16671
@wok
wok / memcachedump.sh
Created June 5, 2015 10:40
Dump memcached content
#!/usr/bin/env ruby
# List all keys stored in memcache.
# Credit to Graham King at http://www.darkcoding.net/software/memcached-list-all-keys/ for the original article on how to get the data from memcache in the first place.
require 'net/telnet'
headings = %w(id expires bytes cache_key)
rows = []
  1. Check if raygun certficiate is correct:

     ruby -rnet/https -e "Net::HTTP.get URI('https://api.raygun.io'); puts 'Everything ok.'"
    
  2. Check ruby default SSL store

     ruby -ropenssl -e 'puts OpenSSL::X509::DEFAULT_CERT_FILE'
    
  3. Append Euqifax Root Certificate to file from step 2

  4. Recheck

# Usage
# copy this file to a new director e.g. /root/chef
# run a single recipe as follows:
# ./local_chef.sh -o recipe[myclub::backup]
# put the cookbook path in solo.rb file.
echo 'cookbook_path ["/opt/aws/opsworks/current/merged-cookbooks"]' > solo.rb
# create json file incase if you want use the attributes from opsworks.
opsworks-agent-cli get_json > attributes.json
@wok
wok / raygun_opsworks.rb
Created September 24, 2015 10:29
raygun_opsworks.rb
# Copyright (c) 2015 Taikala Ltd (www.taikala.fi)
#
# MIT License
#
# 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 furnished to do so, subject to