Skip to content

Instantly share code, notes, and snippets.

View momchilov's full-sized avatar

K Momchilov momchilov

  • London, United Kingdom
View GitHub Profile

Keybase proof

I hereby claim:

  • I am momchilov on github.
  • I am momchilov (https://keybase.io/momchilov) on keybase.
  • I have a public key ASA3Hl0Fm2g0me8SIeF0fJ4kbbPsK6ytva15J_kaDBeliAo

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am momchilov on github.
  • I am momchilov (https://keybase.io/momchilov) on keybase.
  • I have a public key ASDCmqAshkcdZuY4PKMWhuUDCfoWjOAFV3AVzJMg6lXLyAo

To claim this, I am signing this object:

@momchilov
momchilov / secret.rb
Created August 30, 2019 13:07 — forked from sethvargo/secret.rb
Example Chef extension to extract secrets from HashiCorp's Vault
# Please see the following blog post for more information:
#
# https://www.hashicorp.com/blog/using-hashicorp-vault-with-chef.html
#
resource_name :vault_secret
property :path, String, name_property: true
property :destination, String
@momchilov
momchilov / check_disk_space_and_delete_logs.sh
Last active August 29, 2015 14:15
A script to get rid of large log files automatically.
#!/bin/bash
#
# Description:
# Check disk space, find and delete FILE_NAMES larger then
# FILES_LARGER_THEN, if disk space for the partition where
# FILES_DIRECTORY is located is less then DISK_SPACE_PERCENTAGE.
# Useful for keeping disk space under control in directories, such as
# /var/log. You can add it to your crontab, so it executes every
# 3 hours, like so:
#
@momchilov
momchilov / Vagrantfile
Created December 24, 2014 04:18
Modification of the vagrantfile to automatically deploy instances fast
# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'ipaddr'
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
@momchilov
momchilov / check_update_geoip.sh
Created November 6, 2014 23:45
bash script to check if files have been updated
#!/bin/bash
################################################################################
## ##
## This Nagios script checks whether files exist in the specified location ##
## and if they have been modified in specified number of days. ##
## ##
################################################################################
FILES_TO_CHECK="geoip.dat geoip.acl" # space-separated list of files to check
@momchilov
momchilov / log-alarm
Last active December 22, 2015 15:59
This script uses 'logtail' to monitor log activity for selected logfiles and beep the PC speaker when new log messages are discovered.
#!/bin/bash
# this script beeps the PC speaker when there are new messages available
# and shows the new messaegs
#
# REQUIREMENTS:
#
# the script requires "logtail" and "beep" to function
# it requires kernel modules to be loaded: "pcspkr" & "snd_pcsp"
@momchilov
momchilov / sb.rb
Last active December 20, 2015 20:59
switch backup through telnet management interface
#!/usr/bin/env ruby
require 'rubygems'
require 'net/telnet'
require 'mac_vendor'
has_errors = false
# loading mac database
mac_vendor = MacVendor.new :use_local => true
@momchilov
momchilov / gist:2883334
Created June 6, 2012 17:08
Migration parameters for devise 2.1.0
class DeviseCreateInstalls < ActiveRecord::Migration
def change
create_table(:installs) do |t|
## Database authenticatable
t.string :email, :null => false, :default => ""
t.string :encrypted_password, :null => false, :default => ""
## Recoverable
t.string :reset_password_token
t.datetime :reset_password_sent_at
@momchilov
momchilov / gist:1817049
Created February 13, 2012 13:43
Sucky javascript.
$(document).ready(function() {
var loginLink = $("a#login");
var loginWindow = $("div#login");
var loginForm = $('#login-form-dialog');
var submitButton = $('#button-logindialog-submit');
$.fn.submitWithAjax = function() {
this.submit(function() {
$.post(this.action, $(this).serialize(), null, "script");
return false;