Skip to content

Instantly share code, notes, and snippets.

@kasunbg
kasunbg / delete-unused-security-groups.sh
Created January 11, 2019 12:36
Delete unused AWS security groups
comm -23 <(aws ec2 describe-security-groups --query 'SecurityGroups[*].GroupId' --output text | tr '\t' '\n'| sort) \
<(aws ec2 describe-instances --query 'Reservations[*].Instances[*].SecurityGroups[*].GroupId' --output text | tr '\t' '\n' | sort | uniq) \
| tee -a unused-security-groups-in-ec2.txt
for x in `cat unused-security-groups-in-ec2.txt`; do echo 'deleting sg: $x' ; aws ec2 delete-security-group --group-id $x; done
@jonathantneal
jonathantneal / recovery.sh
Last active November 10, 2023 01:01
Create or update macOS Big Sur (or Catalina, or Mojave) Recovery Partition Without Reinstalling
#!/bin/sh
# Set the macOS installer path as a variable
MACOS_INSTALLER="/Applications/$(ls /Applications | grep "Install macOS")"
MOUNT_POINT="$MACOS_INSTALLER/Contents/SharedSupport"
echo "macOS installer is \"$MACOS_INSTALLER\""
# Set the target disk as a variable
TARGET=$(diskutil info "$(bless --info --getBoot)" | awk -F':' '/Volume Name/ { print $2 }' | sed -e 's/^[[:space:]]*//')
echo "Target disk is \"$TARGET\""
@Akhu
Akhu / CoreData + Codable.swift
Created May 11, 2018 09:46
Mixing Codable and Core Data in Swift
//
// Article.swift
// Veille
//
// Created by Anthony Da Cruz on 26/01/2018.
// Copyright © 2018 Anthony Da Cruz. All rights reserved.
//
import Foundation
import CoreData
@denisb411
denisb411 / MicrophoneTracker.swift
Last active November 29, 2017 08:50
An swift iOS class that tracks the microphone fundamental frequency, max amplitude and the microphone samples. Uses the AudioKit framework.
//
// StandardGuitarViewController.swift
// Universal_Tuner
//
// Created by Denis França Candido on 01/04/17.
// Copyright © 2017 Denis França Candido. All rights reserved.
//
import Foundation
import UIKit
@RblSb
RblSb / Browse.hx
Created May 30, 2017 22:52
html5 file reference
class Test {
static function main() {
js.Browser.window.onclick = function() {
var input = js.Browser.document.createElement("input");
input.style.visibility = "hidden"; //comment this to test
input.setAttribute("type", "file");
input.id = "browse";
input.onclick = function(e) {
e.cancelBubble = true;
e.stopPropagation();
@joseph-zhong
joseph-zhong / BUILD_AWS_LAMBDA.md
Last active March 26, 2019 21:11 — forked from mmitou/how-to-build-opencv3.0.0-for-aws-lambda.md
Building OpenCV for AWS Lambda Python

To build OpenCV3.0 for AWS Lambda Python

Summary

Because AWS Lambda runs in a Amazon Linux environment, to run external modules you must

Create the OpenCV build environment

sudo yum update -y
//
// LiveFrameCaptureViewController.swift
// SCNKit2Video
//
// Created by Lacy Rhoades on 11/29/16
// Revised 7/19/17
// Copyright © 2017 Lacy Rhoades. All rights reserved.
//
import Foundation
@robschmuecker
robschmuecker / README.md
Last active February 25, 2022 16:04
Clickable link Drag and Drop zoomable D3.js tree example.
@marcogrueter
marcogrueter / progress-cmd-line.php
Created October 18, 2013 07:38
Percentage progress bar on cmd line in php
$data = getData();
$step = 100 / count($data);
$percent = 0;
echo 'Doing stuff with data: '; //padding at the end for the number
foreach($data as $row)
{
// do stuff