Skip to content

Instantly share code, notes, and snippets.

View dandye's full-sized avatar

DanDye dandye

View GitHub Profile
@dandye
dandye / gist:3b2439bad4893dbb0f3f0bbf37d47b7d
Created May 13, 2017 14:54
MacOS save screenshots to dir
mkdir ~/Documents/Screenshots
defaults write com.apple.screencapture location ~/Documents/Screenshots
killall SystemUIServer
@dandye
dandye / compile_install_tmux2.3.sh
Created April 6, 2017 00:07
Compile tmux 2.3 on CentOS 6
sudo yum install gcc kernel-devel make ncurses-devel wget automake
curl -OL https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
tar -xzvf libevent-2.0.21-stable.tar.gz
cd libevent-2.0.21-stable
./configure --prefix=/usr/local
make
sudo make install
@dandye
dandye / ranpwd.spec
Created January 19, 2017 22:39
RPM spec file for ranpwd v1.1-1
[admin@localhost ~]$ vim ranpwd.spec
Summary: A program to generate random passwords
Name: ranpwd
Version: 1.1
Release: 1
License: GPL
Group: Applications/System
Source0: ftp://ftp.kernel.org/pub/software/utils/admin/ranpwd/%{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
@dandye
dandye / aws_cli_open_port.sh
Created January 17, 2017 13:43
AWS CLI Open Port for my IP in specified security group
pip install awscli
export AWS_ACCESS_KEY_ID=$AWS_alice_ACCESS_KEY_ID
export AWS_SECRET_ACCESS_KEY=$AWS_alice_SECRET_ACCESS_KEY
export AWS_DEFAULT_REGION=$AWS_alice_DEFAULT_REGION
export AWS_GROUP_ID=$AWS_alice_GROUP_ID
aws ec2 authorize-security-group-ingress \
--group-id $AWS_GROUP_ID \
--protocol tcp \
--port 22 \
--cidr $(dig +short myip.opendns.com @resolver1.opendns.com)/32)
@dandye
dandye / gist:a4b3f154aab6c1bbc082a21abc6bfd14
Created January 16, 2017 13:33
Rebase and Squash before opening Pull Request
git checkout master
git pull
git checkout -b travis_runs_protractor_tests travis_integration_tests_for_edge_v2x
git rebase master
git log --pretty=format:"%h%x09%an%x09%ad%x09%s" -n 45
git rebase -i HEAD~32
git push origin travis_runs_protractor_tests
@dandye
dandye / extract_public_key.sh
Created January 10, 2017 12:11
openSSL: how to extract public key
openssl rsa -in privkey.pem -pubout > key.pub
# http://stackoverflow.com/questions/10271197/openssl-how-to-extract-public-key
@dandye
dandye / install_vmware_vdiskmanager.sh
Last active February 7, 2024 18:34
How to install vmware-vdiskmanager
tar xvf VMware-vix-disklib-6.0.2-3566099.x86_64.tar.gz
cd vmware-vix-disklib-distrib/bin64
sudo ln -s $(pwd)/vmware-vdiskmanager /usr/bin/vmware-vdiskmanager
ls -l /usr/bin/vmware-vdiskmanager
cd ../lib64/
sudo ln -s $(pwd) /usr/lib/vmware
sudo bash -c "echo $(pwd) > /etc/ld.so.conf.d/vmware-vix-disklib.conf"
sudo ldconfig
@dandye
dandye / bootstrap_salt_cloudinit.rst
Created December 30, 2016 12:41 — forked from abhishekctn/bootstrap_salt_cloudinit.rst
Bootstrapping Salt on Linux EC2 with CloudInit

Boostrapping Salt on Linux EC2 with Cloud-Init

Salt is a great tool for remote execution and configuration management, however you will still need to bootstrap the daemon when spinning up a new node. One option is to create and save a custom AMI, but this creates another resource to maintain and document.

A better method for Linux machines uses Canonical's CloudInit to run a bootstrap script during an EC2 Instance initialization. Cloud-init takes the user_data string passed into a new AWS instance and runs it in a manner similar to rc.local. The bootstrap script needs to:

  1. Install Salt with dependencies
  2. Point the minion to the master
@dandye
dandye / ubuntu-cloud-virtualbox.sh
Created December 28, 2016 10:21 — forked from smoser/ubuntu-cloud-virtualbox.sh
example of using Ubuntu cloud images with virtualbox
## Install necessary packages
$ sudo apt-get install virtualbox-ose qemu-utils genisoimage cloud-utils
## get kvm unloaded so virtualbox can load
$ sudo modprobe -r kvm_amd kvm_intel
$ sudo service virtualbox stop
$ sudo service virtualbox start
## URL to most recent cloud image of 12.04
$ img_url="http://cloud-images.ubuntu.com/server/releases/12.04/release"
@dandye
dandye / TAXII-1.1.postman_collection.json
Created October 27, 2016 02:45 — forked from jtschichold/TAXII-1.1.postman_collection.json
Simple Postman Collection for TAXII 1.1 Requests
{
"variables": [],
"info": {
"name": "TAXII-1.1 (0.1)",
"_postman_id": "f355c2a2-5d3e-6f5b-f957-afe4d5646d7a",
"description": "Simple collection of TAXII 1.1 requests.\nYou need an environment with the following keys to run this:\n- hostname: hostname of the TAXII server\n- collection: name of the collection to poll (needed only for Poll Request)\n\nDiscovery request points to {{hostname}}/taxii-discovery-service\n\nCollection Information Request points to {{hostname}}/taxii-collection-management-service\n\nPoll Request to {{hostname}}/taxii-poll-service",
"schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
},
"item": [
{