Skip to content

Instantly share code, notes, and snippets.

View sribalakumar's full-sized avatar

Bala Kumar sribalakumar

  • FreshDesk
  • Chennai
View GitHub Profile
@sribalakumar
sribalakumar / install_notes.sh
Created August 29, 2020 19:52
os_x_catalina_ruby_2.6.3_install_notes.sh
CPPFLAGS='-Wno-nullability-completeness -Wbuiltin-requires-header -Wexpansion-to-defined' \
CC=/usr/bin/gcc \
rvm reinstall 2.6.3 --with-openssl-dir=`brew --prefix openssl`
# Simple HAProxy config to block ip, domain
acl blacklist_ip hdr_ip(x-forwarded-for,-1), map_ip(blacklisted_ips.lst) -m found
acl blacklist_domain hdr(host), map_str(blacklisted_domains.lst) -m found
http-request deny if is_bad_request or blacklist_ip or blacklist_domain
CREATE EVENT kill_long_transactions ON SCHEDULE EVERY x SECOND
DO
BEGIN
DECLARE max_transaction_time INT DEFAULT 25;
DECLARE done INT DEFAULT 0;
DECLARE killed_id BIGINT;
DECLARE killed_user VARCHAR(16);
DECLARE killed_host VARCHAR(64);
DECLARE kill_stmt VARCHAR(20);
DECLARE time_taken VARCHAR(20);
@sribalakumar
sribalakumar / tmux-cheatsheet.markdown
Last active September 3, 2015 04:35 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@sribalakumar
sribalakumar / Bootstrap typeahead with Google Auto Suggest
Created October 1, 2014 08:55
Bootstrap typeahead with Google Auto Suggest
<label for="auto_suggest">Google Auto Suggest: </label>
<input id="auto_suggest" type="text" width="500">
<script src="https://code.jquery.com/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.1.0/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<script>
var google_auto_suggest_url = "http://suggestqueries.google.com/complete/search?client=chrome&q=";
$('#auto_suggest').typeahead({
source: function(query, process) {
@sribalakumar
sribalakumar / jQuery Auto Complete consuming Google Suggestion
Created October 1, 2014 07:56
jQuery Auto Complete consuming Google Suggestion
<script src="https://code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="https://code.jquery.com/ui/1.11.0/jquery-ui.min.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css">
<script>
var google_suggest_url = "http://suggestqueries.google.com/complete/search?client=chrome&q=";
$(function() {
$("#google-suggest").autocomplete({
source: function(request, response) {
var temp_arr = request.term.split(/[.,]+/); // Regex so that sentences after , or . are treated as new sentence.