Skip to content

Instantly share code, notes, and snippets.

Avatar

Bala Kumar sribalakumar

View GitHub Profile
@sribalakumar
sribalakumar / install_notes.sh
Created Aug 29, 2020
os_x_catalina_ruby_2.6.3_install_notes.sh
View 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`
View haproxy_blocking_example.cfg
# 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
View db_event_kill_long_transactions.sql
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);
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@sribalakumar
sribalakumar / Bootstrap typeahead with Google Auto Suggest
Created Oct 1, 2014
Bootstrap typeahead with Google Auto Suggest
View 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 Oct 1, 2014
jQuery Auto Complete consuming Google Suggestion
View 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.
You can’t perform that action at this time.