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
@devilankur18
devilankur18 / vcsheet.js
Last active October 29, 2023 08:42
Scrape Data from Browser Console
// How to use this
// 1. Go to vc list and set filters to shortlist vcs
// 2. Open Chrome Console
// 3. Paste the script, it will auto download the data as json
// 4. Optional, if you want csv, then go to https://csvjson.com/json2csv, upload the json to get csv
// Initialize an array to store the data
const dataArray = [];

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.

@devilankur18
devilankur18 / emq.config
Created April 4, 2018 14:41
deploy elasticbeanstalk on ec2 instance, with auto join cluster and auto scale
files:
# If this file is edited, it must be removed from EC2 instance prior to deploy.
"/opt/elasticbeanstalk/hooks/appdeploy/pre/09_emq_install.sh" :
mode: "000775"
owner: root
group: users
content: |
#!/bin/bash -xe
export NODE_USERNAME=emq
<script type="text/javascript">
;(function(p,l,o,w,i,n,g){if(!p[i]){p.GlobalSnowplowNamespace=p.GlobalSnowplowNamespace||[];
p.GlobalSnowplowNamespace.push(i);p[i]=function(){(p[i].q=p[i].q||[]).push(arguments)
};p[i].q=p[i].q||[];n=l.createElement(o);g=l.getElementsByTagName(o)[0];n.async=1;
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.5.1/sp.js","snowplow_name_here"));
snowplow_name_here("newTracker", "cf", "collector.smugglr.co", {
appId: "3e2f2964-6c7c-4576-9b54-e48c7d3f5486",
platform: "web",
cookieDomain: '.smugglr.co',
discoverRootDomain: false,
@devilankur18
devilankur18 / rewrite_rules_for_appache
Created December 20, 2016 14:59
HTML5 AWS ELB force https
RewriteEngine on
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTP_USER_AGENT} !^ELB-HealthChecker/1.0
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L]
# Don't rewrite files or directories
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
@devilankur18
devilankur18 / srcripts_authentication_script
Created February 22, 2016 19:32
ejabberd external auth rails ruby script
#!/usr/bin/env ruby
require 'logger'
require 'rest_client'
require 'rexml/document'
include REXML
$stdout.sync = true
$stdin.sync = true
@devilankur18
devilankur18 / services-status.md
Last active August 29, 2015 14:25
coreos multinode cluster errors
$fleetctl list-machines
MACHINE   IP    METADATA
0f61935f... 128.199.80.59 role=node
c225ca77... 128.199.188.212 role=master
core@master /etc/systemd/system $ sudo systemctl status *
● flanneld.service.d.service
   Loaded: not-found (Reason: No such file or directory)
   Active: inactive (dead)

● generate-serviceaccount-key.service - Generate service-account key file

#!/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