Skip to content

Instantly share code, notes, and snippets.

=== REDIS BUG REPORT START: Cut & paste starting from here ===
[23745] 31 Jan 01:46:44.911 # Redis 2.8.4 crashed by signal: 11
[23745] 31 Jan 01:46:44.912 # Failed assertion: <no assertion failed> (<no file>:0)
[23745] 31 Jan 01:46:44.912 # --- STACK TRACE
/usr/local/bin/redis-server *:26379(logStackTrace+0x43)[0x445c93]
/usr/local/bin/redis-server *:26379(sentinelGetMasterByNameOrReplyError+0x17)[0x44e697]
/lib64/libpthread.so.0(+0xf710)[0x7ff7b9fba710]
/usr/local/bin/redis-server *:26379(sentinelGetMasterByNameOrReplyError+0x17)[0x44e697]
/usr/local/bin/redis-server *:26379(sentinelCommand+0x115)[0x4521a5]
/usr/local/bin/redis-server *:26379(call+0x70)[0x41b240]
// in a script file - we can attach a listener to a form ... this code handles the case that the form is for creating and editing a record. the code below detects whether the UA supports pushState and rather than redirecting to get the new window state, it can do this client side and use pushState to set the URL correctly..
if (updateOnNew && typeof(window.history.pushState) == 'function') {
window.history.pushState("", "Edit Schedule", schedule.update_url + "/edit");
// update any local page state...
} else if (updateOnNew) {
window.location = schedule.update_url + "/edit"; // older browser must redirect on new update
}
@taf2
taf2 / Dalli.txt
Created February 12, 2014 22:48
This is a bug in Dalli
Unexpected exception in Dalli: ArgumentError: wrong number of arguments (1 for 2)
[ee0b343a3f5d9800f2ff8089b00be93a] [99.238.97.25] This is a bug in Dalli, please enter an issue in Github if it does not already exist.
[ee0b343a3f5d9800f2ff8089b00be93a] [99.238.97.25] /var/www/apps/this_is_an_app/shared/bundle/ruby/2.0.0/gems/dalli-2.7.0/lib/dalli/server.rb:299:in `delete'
/var/www/apps/this_is_an_app/shared/bundle/ruby/2.0.0/gems/dalli-2.7.0/lib/dalli/server.rb:60:in `request'
/var/www/apps/this_is_an_app/shared/bundle/ruby/2.0.0/gems/dalli-2.7.0/lib/dalli/options.rb:18:in `block in request'
/usr/local/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/var/www/apps/this_is_an_app/shared/bundle/ruby/2.0.0/gems/dalli-2.7.0/lib/dalli/options.rb:17:in `request'
/var/www/apps/this_is_an_app/releases/20140212215756/app/controllers/application_controller.rb:344:in `block in expire_calltracking_file'
/var/www/apps/this_is_an_app/releases/20140212215756/app/controllers/application_controller.rb:344:in `each'
/var/www
@taf2
taf2 / security-group-updates.sh
Created March 17, 2014 02:17
OpenStack script to add a new or existing security group to a server.
#!/bin/bash
#
# Add Named Security Group and Default to the given IP Address
# security-group-updates.sh ipaddress
#
NAME_TO_ADD='the security group name' # name of the security group to add
ADD_SECURITY='xxxxxxx-xxxx-...' # ID of the security group to add
DEFAULT_SECURITY='xxxxxxx-xxxx-...' # ID of the default security group you want to keep
# check if the give hostip has a security group and needs to be updated
@taf2
taf2 / examples.js
Created April 2, 2014 14:16
number replacement with custom formatting examples
// insert code here: https://calltrackingmetrics.com/accounts/tracking_script_settings
window.CTMSourceEvent = function(event) {
if(event.state=='after') {
// generic solution to replace a number format for a given element after our code runs e.g. after event.
document.getElementById("the-phone").innerHTML = "Insert Your Custom Number Format";
}
if (event.state == 'node:after') {
// more fine grained control of replacement you have access to the exact DOM Element we've located a number and replaced.
@taf2
taf2 / count.sh
Created April 23, 2014 02:36
confirm index
curl -XGET 'http://10.241.0.241:9200/calls/call/_count?pretty=1' -d '{
"query": {
"term": { "account_id": 25 }
}
}'
{
"cluster_name" : "elasticsearch",
"status" : "red",
"timed_out" : false,
"number_of_nodes" : 1,
"number_of_data_nodes" : 1,
"active_primary_shards" : 14,
"active_shards" : 14,
"relocating_shards" : 0,
"initializing_shards" : 0,
@taf2
taf2 / monit.newrelic-mysql
Created April 28, 2014 02:21
never let a monitor process steal your memory
check process newrelic-mysql
with pidfile "/var/run/newrelicmysql.pid"
start program = "/etc/init.d/newrelic-mysql start"
stop program = "/etc/init.d/newrelic-mysql stop"
if 2 restarts within 3 cycles then timeout
if totalmem > 100 Mb then alert
if cpu usage > 95% for 3 cycles then restart
if 5 restarts within 5 cycles then timeout
# query.count # rails 4.1 -> select count(distinct(texts.id), texts.*) from texts
# query.count # rails 4.0 -> select count(distinct(texts.id)) from texts
window.CTMSourceEvent = function(event) {
if (event.state != "before") { return }
// console.log(event.rule[2]);
// your code ga here: ga.send("event", ... )
}