Skip to content

Instantly share code, notes, and snippets.

@keyurshah
keyurshah / slave_running
Last active August 8, 2016 17:58
#mysql Detect if a mysql slave is still running and touch slave_running, monit then watches the timestamp on the file
check file slave_running with path /opt/slave_running
if timestamp > 3 minutes then alert
@keyurshah
keyurshah / asdfmouse.ahk
Last active August 8, 2016 17:54 — forked from tinku99/asdfmouse.ahk
#autohotkey
CustomColor = 000000
Gui +LastFound +AlwaysOnTop -Caption +ToolWindow ; +ToolWindow avoids a taskbar button and an alt-tab menu item.
Gui, Color, %CustomColor%
Gui, Font, s10 cwhite
yb := A_ScreenHeight - 40
xb := A_ScreenWidth - 40
loop, 26{
char := chr(Asc("A") + A_Index - 1)
x := floor(A_ScreenWidth * (1 - ((asc("Z") - asc(char) + 1) / 26)) )
loop, 26{
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.
class Filterable {
public $model;
public $options;
public function __construct($model) {
$this->model = $model;
}
@keyurshah
keyurshah / capslock_remap_alt.ahk
Last active December 15, 2021 16:08 — forked from Danik/capslock_remap_alt.ahk
#autohotkey
; Autohotkey Capslock Remapping Script
; Danik
; More info at http://danikgames.com/blog/?p=714
; danikgames.com
;
; Functionality:
; - Deactivates capslock for normal (accidental) use.
; - Hold Capslock and drag anywhere in a window to move it (not just the title bar).
; - Access the following functions when pressing Capslock:
; Cursor keys - J, K, L, I
@keyurshah
keyurshah / v-cloak.md
Last active August 8, 2016 18:02 — forked from adamwathan/v-cloak.md
#vuejs

Handy helpers for controlling visibility of elements until Vue has compiled.

Use like:

<div v-cloak>
  <h1>
    <span class="v-cloak--inline">Loading...</span> <!-- Only displayed before compiling -->
    <span class="v-cloak--hidden">{{ post.title }}</span> <!-- Hidden until compiling is finished -->
 
@keyurshah
keyurshah / CapsUnlocked.ahk
Last active August 8, 2016 17:54 — forked from kshenoy/CapsUnlocked.ahk
#autohotkey
; This is a complete solution to map the CapsLock key to Control and Escape without losing the ability to toggle CapsLock
; We use two tools here - any remapping software to map CapsLock to LControl and AutoHotkey to execute the following script
; This has been tested with MapKeyboard (by Inchwest)
; This will allow you to
; * Use CapsLock as Escape if it's the only key that is pressed and released within 300ms (this can be changed below)
; * Use CapsLock as LControl when used in conjunction with some other key or if it's held longer than 300ms
; * Toggle CapsLock by pressing LControl/CapsLock + RControl
~*LControl::
@keyurshah
keyurshah / app\Http\Kernel.php
Last active August 8, 2016 17:57
#laravel handling reverse proxies for laravel
<?php
// ...
protected $middleware = [
// ...
'App\Http\Middleware\ValidProxies',
];
// ...
@keyurshah
keyurshah / CVimrc
Last active January 16, 2018 19:30
#cvim
set regexp
set ignorecase
let blacklists = ["https://paper.dropbox.com/*", "https://coda.io/*", "https://mail.google.com/*", "*://mail.google.com/*", "@https://mail.google.com/mail/*", "*://codepen.io/*", "*://trello.com/*", "*.pcirapidcomply2.com/*"]
" blacklists prefixed by '@' act as a whitelist
let barposition = "bottom"
"unmap gt
class PostsController < ActionController::Base
def create
Post.create(post_params)
end
def update
Post.find(params[:id]).update_attributes!(post_params)
end
private