Skip to content

Instantly share code, notes, and snippets.

View nisanthchunduru's full-sized avatar

Nisanth Chunduru nisanthchunduru

View GitHub Profile
@nisanthchunduru
nisanthchunduru / clone_and_restore_server_harddisk.md
Last active August 1, 2023 07:52
Clone and restore a physical server's harddisk

Clone a server's harddisk

Login to Hetzner's web interface https://robot.your-server.de/ and activate the Rescue System for the server whose disk you wish to clone.

Ssh into the Rescue System (Replace 1.2.3.4 in the command below with the actual ip address of the server)

ssh -o HostKeyAlias=hetzner-rescue.1.2.3.4 [email protected]
@nisanthchunduru
nisanthchunduru / decode_session_cookie.rb
Created August 30, 2017 13:18
Decode Session Cookie in Rails 3
@nisanthchunduru
nisanthchunduru / 176_9_149_227_interfaces
Created August 22, 2017 18:19
Missing IPv6 Configuration
root@Ubuntu-1604-xenial-64-minimal ~ # cat /etc/network/interfaces
### Hetzner Online GmbH installimage
source /etc/network/interfaces.d/*
auto lo
iface lo inet loopback
iface lo inet6 loopback
auto eth0
@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("", "<<"))'
@nisanthchunduru
nisanthchunduru / README.md
Last active July 26, 2017 14:47
zsh function to quick convert an issue to a pull request

Run

issuetopr 1256

to convert issue 1256 to a pull request.

Copy the function issuetopr to your .bashrc or .zshrc to start using it.

@nisanthchunduru
nisanthchunduru / magicbell.io
Last active July 7, 2017 10:30
Example nginx configuration file for phusion passenger open source
server {
listen 443;
root /home/rails/apps/magicbell_site/current/public;
server_name magicbell.io;
# Use certificates we purchased from https://www.ssl2buy.com
ssl on;
ssl_certificate /etc/nginx/certs/magicbell.io/magicbell.io.crt;
ssl_certificate_key /etc/nginx/certs/magicbell.io/magicbell.io.key;
@nisanthchunduru
nisanthchunduru / backup_dotfiles.rb
Created June 12, 2017 10:36
Backup dotfiles that RCM already tracks
require "fileutils"
class DotfileInfo
def initialize(dotfile_info_string)
@dotfile_info_string = dotfile_info_string
end
def path
@dotfile_info_string.split(":")[0]
end
<?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 / newrelic-plugin-agent.cfg
Last active November 1, 2016 06:27
New Relic Postfix Plugin Example Configuration
%YAML 1.2
---
Application:
license_key: YOUR_NEWRELIC_LICENSE_KEY
wake_interval: 60
#newrelic_api_timeout: 10
#proxy: http://localhost:8080
postfix: {}
Thread 2 (Thread 0x7fda555c0700 (LWP 2244)):
#0 0x00007fda55786883 in poll () from /lib/libc.so.6
#1 0x00007fda566d6809 in timer_thread_sleep (p=<value optimized out>) at thread_pthread.c:1438
#2 thread_timer (p=<value optimized out>) at thread_pthread.c:1549
#3 0x00007fda562ef8ca in start_thread () from /lib/libpthread.so.0
#4 0x00007fda557917dd in clone () from /lib/libc.so.6
#5 0x0000000000000000 in ?? ()
Thread 1 (Thread 0x7fda56bb4700 (LWP 2242)):