Skip to content

Instantly share code, notes, and snippets.

View voidead's full-sized avatar
🏠
Working from home

Balvinder Singh voidead

🏠
Working from home
View GitHub Profile
@voidead
voidead / start-stop-ec2-instances.js
Created June 6, 2020 03:45 — forked from eddmann/start-stop-ec2-instances.js
Scheduled Start/Stop of EC2 Instances using Lambda and CloudWatch Events
// Demonstration video can be found at: https://youtu.be/roAerKVfq-Y
// StopEC2Instance
const AWS = require('aws-sdk');
exports.handler = (event, context, callback) => {
const ec2 = new AWS.EC2({ region: event.instanceRegion });
ec2.stopInstances({ InstanceIds: [event.instanceId] }).promise()
@voidead
voidead / Vagrantfile
Created May 30, 2020 15:16 — forked from hodak/Vagrantfile
Add SSH key as authorized key for Vagrant's root
Vagrant.configure(2) do |config|
...
id_rsa_pub = File.read("#{Dir.home}/.ssh/id_rsa.pub")
config.vm.provision "copy ssh public key", type: "shell",
inline: "echo \"#{id_rsa_pub}\" >> /home/vagrant/.ssh/authorized_keys"
end
@voidead
voidead / free-memory.rb
Created May 21, 2019 04:22 — forked from vigo/free-memory.rb
"free" command for osx. Shows available memory
#!/usr/bin/env ruby
# encoding: utf-8
# By Uğur Özyılmazel, @vigobronx | @ugurozyilmazel
# http://vigodome.com | http://ugur.ozyilmazel.com | https://github.com/vigo
def get_paged_memory_usage(match_string, paging=4096)
mvar = 3
if match_string.split(/[^\w]/).length > 1
mvar = 4