Skip to content

Instantly share code, notes, and snippets.

View nisanthchunduru's full-sized avatar

Nisanth Chunduru nisanthchunduru

View GitHub Profile
@nisanthchunduru
nisanthchunduru / gist:d341ab22dede19e572d0e8152393e93a
Created June 8, 2021 13:40 — forked from ryanbriones/gist:246599
send email to gmail (STARTTLS) using ruby >=1.8.7
# send email using STARTTLS; Net::SMTP#enable_starttls requires ruby >=1.8.7
# this hack is needed for rails <2.3; apparently >=2.3 has something for this already
ActionMailer::Base.class_eval do
private
def perform_delivery_smtp(mail)
destinations = mail.destinations
mail.ready_to_send
smtp = Net::SMTP.new(smtp_settings[:address], smtp_settings[:port])

Better SSH Authorized Keys Management

A seemingly common problem that people encounter is how to handle all of your users authorized_keys file.

People struggle over management, ensuring that users only have specific keys in the authorized_keys file or even a method for expiring keys. A centralized key management system could help provide all of this functionality with a little scripting.

One piece of functionality overlooked in OpenSSH is the AuthorizedKeysCommand configuration keyword. This configuration allows you to specify a command that will run during login to retrieve a users public key file from a remote source and perform validation just as if the authorized_keys file was local.

Here is an example directory structure for a set of users with SSH public keys that can be shared out via a web server:

@nisanthchunduru
nisanthchunduru / edid-decode source URL
Created July 27, 2017 19:35 — forked from OneSadCookie/edid-decode source URL
EDID decoding on the Mac, to find out what resolutions and rates the Mac is seeing reported.
http://cgit.freedesktop.org/xorg/app/edid-decode/plain/edid-decode.c
compile with:
gcc edid-decode.c -o edid-decode
get EDID from IORegistryExplorer (mine, an old 24" Apple Cinema Display, is attached).
Convert to binary with this command:
ruby -e 'File.open("edid", "wb").write(File.read("edid.txt").split.map { |s| ("0x"+s).to_i(16) }.inject("", "<<"))'
<?PHP
/**
* pingdom.php
*
* This application will check your server swap, hard drive, cpu, and MySQL conditions.
* It will then generate an appropriate XML file for a Pingdom HTTP Custom check.
*
* If any usage is above your preset thresholds, then a down message will be returned,
* indicating that your server may be under more load than usual, hopefully, providing
* a bit of advanced notice before a true failure due to lack of resources
@nisanthchunduru
nisanthchunduru / README.md
Last active August 29, 2015 14:27 — forked from lopezjurip/README.md
Write to NTFS on OSX Yosemite and El Capitan

Install Homebrew:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Update Homebrew formulae:

brew update
@nisanthchunduru
nisanthchunduru / gist:2e510824266886a59571
Last active August 29, 2015 14:26 — forked from ruckus/gist:2293434
Basic setup of WAL-E for continuous archiving and recovery

WAL-E needs to be installed on all machines, masters and slaves.

How to install WAL-E

Only one machine, the master, writes WAL segments via continuous archiving. The configuration for the master postgresql.conf is:

archive_mode = on
archive_command = 'envdir /etc/wal-e.d/env wal-e wal-push %p'
archive_timeout = 60
.fadeinDown {
-webkit-animation: fadeInDown 500ms ease-in-out; /* Chrome, Safari, Opera */
animation: fadeInDown 500ms ease-in-out;
}
/* Chrome, Safari, Opera */
@-webkit-keyframes fadeInDown {
0% {

Installing pdnsd from homebrew as root user.

$ brew install pdnsd

$ sudo chown -R nobody /usr/local/var/cache/pdnsd

$ curl -L http://goo.gl/kMlyQ -o pdnsd.conf
$ mv pdnsd.conf /usr/local/etc
$ sudo chown root /usr/local/etc/pdnsd.conf
@nisanthchunduru
nisanthchunduru / 0_reuse_code.js
Last active August 29, 2015 14:16
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
# ...
namespace :deploy do
desc 'Restart application'
task :restart => ["eye:reload", "eye:restart"]
after :published, :restart
end