Skip to content

Instantly share code, notes, and snippets.

@ageekymonk
ageekymonk / proxy.el
Last active May 8, 2020 14:59
spacemacs
;;;; Proxy
(defun module/proxy ()
"Set Proxy"
(defun set-work-proxy ()
"Set your work proxy."
(interactive)
;; Set proxy configurations in emacs
(setq url-proxy-services
'(("no_proxy" . "^\\(localhost\\|127.0.0.1\\)")
@ageekymonk
ageekymonk / bash_template.sh
Created July 7, 2015 03:53
bash template
#!/bin/bash
# ------------------------------------------------------------------
# [Author] Title
# Description
# ------------------------------------------------------------------
set -e
SUBJECT=some-unique-id
@ageekymonk
ageekymonk / aws-cloudformation-simple-vpc.json
Created December 20, 2014 06:06
Cloudformation Script to create a VPC with one subnet in aws
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "AWS Template to create a a VPC",
"Resources" : {
"VPC" : {
"Type" : "AWS::EC2::VPC",
"Properties" : {
"CidrBlock" : "10.0.0.0/16",
@ageekymonk
ageekymonk / Vagrantfile
Last active August 29, 2015 14:11
awsVagrant
# -*- mode: ruby -*-
# vi: set ft=ruby :
AWS_PRIVATE_KEY_PATH = 'mykey.pem'
AWS_ACCESS_KEY_ID = 'XXXYYYZZZ'
AWS_SECRET_KEY = 'XXXZZZZYYY'
awsboxes = [
{
:name => 'puppet',
@ageekymonk
ageekymonk / uthash.h
Created November 19, 2014 01:54
Hash library taken from
/*
Copyright (c) 2003-2014, Troy D. Hanson http://troydhanson.github.com/uthash/
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
@ageekymonk
ageekymonk / list.h
Last active August 29, 2015 14:09
Single Linked List
#ifndef _LIST_H
#define _LIST_H
#include <stddef.h>
/*
* Simple doubly linked list implementation.
*
* Some of the internal functions ("__xxx") are useful when
* manipulating whole lists rather than single entries, as
* sometimes we already know the next/prev entries and we can
@ageekymonk
ageekymonk / usb-autoinstall.sh
Created September 5, 2014 03:45
Custom USB Debian Installer with preseed
disk=$1
iso=$2
primary="$disk"1
if [ -z $disk ]
then
echo "Specify a correct drive name"
exit
fi
if [ -z $iso ]
@ageekymonk
ageekymonk / selsnip.java
Last active November 15, 2020 05:30
Selenium Snippets
List<WebElement> options = driver.findElements(By.cssSelector("xxx"));
for (Iterator<WebElement> iterator = options.iterator(); iterator.hasNext();) {
WebElement webElement = (WebElement) iterator.next();
try
{
if (webElement.findElement(By.cssSelector("k-item")).getText().equals("Processing"))
{
webElement.findElement(By.cssSelector("k-item")).click();
webElement.findElement(By.cssSelector("k-icon")).click();
@ageekymonk
ageekymonk / graphAPI.cpp
Last active August 29, 2015 13:57
A simple Graph API with DFS and BFS Implementation
#include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <stdexcept>
#include <iterator>
#include <queue>
#include <stack>
@ageekymonk
ageekymonk / binarytree.cpp
Created March 27, 2014 00:52
Binary Tree
#include <iostream>
#include <vector>
using namespace std;
template <class T> class TreeTraversal;
template <class T>
class TreeNode
{
public: