Skip to content

Instantly share code, notes, and snippets.

View devilankur18's full-sized avatar
💭
Building Copilots Stacks at SugarAI

Ankur Agarwal devilankur18

💭
Building Copilots Stacks at SugarAI
View GitHub Profile

SSH agent forwarding and screen

When connecting to a remote server via SSH it is often convenient to use SSH agent forwarding so that you don't need a separate keypair on that server for connecting to further servers.

This is enabled by adding the

ForwardAgent yes

option to any of your Host entries in ~/.ssh/config (or alternatively with the -A option). Don't set this option in a wildcard Host * section since any user on the remote server that can bypass file permissions can now als use keys loaded in your SSH agent. So only use this with hosts you trust.

#!/usr/bin/python
# Set up a new A record in Cloudflare, add the details of it along with your account details below
# Make sure this script runs on startup (or whenever you get a new IP...)
#
# @author Aaron Rice <aaron@duedil.com>
import urllib
import json
#~/.local/share/applications/mimeapps.list
[Added Associations]
#...
x-scheme-handler/subl=subl-urlhandler.desktop
#!/bin/bash
# herein we backup our indexes! this script should run at like 6pm or something, after logstash
# rotates to a new ES index and theres no new data coming in to the old one. we grab metadatas,
# compress the data files, create a restore script, and push it all up to S3.
TODAY=`date +"%Y.%m.%d"`
INDEXNAME="logstash-$TODAY" # this had better match the index name in ES
INDEXDIR="/usr/local/elasticsearch/data/logstash/nodes/0/indices/"
BACKUPCMD="/usr/local/backupTools/s3cmd --config=/usr/local/backupTools/s3cfg put"
BACKUPDIR="/mnt/es-backups/"
YEARMONTH=`date +"%Y-%m"`
@devilankur18
devilankur18 / .gitignore
Created September 13, 2012 16:49 — forked from karmi/.gitignore
Bootstrap, install and configure ElasticSearch with Chef Solo: Ubuntu 12.04 64 Bit
.DS_Store
node.json
tmp/
@devilankur18
devilankur18 / gist:3451287
Created August 24, 2012 14:31 — forked from JosephPecoraro/shell-execution.rb
Shell Execution in Ruby
# Ways to execute a shell script in Ruby
# Example Script - Joseph Pecoraro
cmd = "echo 'hi'" # Sample string that can be used
# 1. Kernel#` - commonly called backticks - `cmd`
# This is like many other languages, including bash, PHP, and Perl
# Returns the result of the shell command
# Docs: http://ruby-doc.org/core/classes/Kernel.html#M001111
@devilankur18
devilankur18 / install-syntastic.sh
Created May 4, 2012 03:52 — forked from coolaj86/install-syntastic.sh
vim? JavaScript? syntastic!
# This is how you install syntax checking for JavaScript in vim
mkdir -p ~/.vim/autoload ~/.vim/bundle; \
curl -so ~/.vim/autoload/pathogen.vim \
https://raw.github.com/tpope/vim-pathogen/HEAD/autoload/pathogen.vim
npm install -g jshint
cd ~/.vim/bundle
git clone https://github.com/scrooloose/syntastic.git
/*
* See http://mathiasbynens.be/notes/async-analytics-snippet#comment-14
*/
<script>
var clicky = (function f(){return {log:f, goal:f};})(),
clicky_site_id = XXXXXX;
(function(d, t) {
var c = d.createElement(t),
s = d.getElementsByTagName(t)[0];