Skip to content

Instantly share code, notes, and snippets.

View mandeepbal's full-sized avatar
🔥
🔥

Mandeep Bal mandeepbal

🔥
🔥
View GitHub Profile
@mandeepbal
mandeepbal / Makefile
Created July 10, 2023 19:29
Makefile - python template
SHELL := bash
.SHELLFLAGS := -eu -o pipefail -c
# .DELETE_ON_ERROR:
MAKEFLAGS = --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
# Override PWD so that it's always based on the location of the file and **NOT**
# based on where the shell is when calling `make`. This is useful if `make`
# is called like `make -C <some path>`
@mandeepbal
mandeepbal / how-to-restore.md
Created May 24, 2022 05:03 — forked from AmazingTurtle/how-to-restore.md
restore access to unifi controller

Restore access to a unifi controller

When you are unable to login to the unifi controller or forgot admin password, you can restore access using SSH and manipulating mongodb directly.

Warning

Do not uninstall unifi controller - most of the data is not stored in mongodb. In case you thought a mongodb backup would be sufficient, you may have fucked up already, just like me. However I managed to write this "tutorial" for anyone to not run into the same trap.

Steps

@mandeepbal
mandeepbal / gist:872abb8916ae3e98a3ace848b3b4cef5
Last active July 15, 2020 20:20
Formatting SD card with partition that mac doesn't recognize

Formatting SD card with partition that mac doesn't recognize

List Partitions

➜  ~ diskutil list                                
/dev/disk3 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *16.2 GB    disk3
   1:                  Apple_HFS Untitled                67.1 MB    disk3s1
   2:                      Linux                         16.2 GB    disk3s2
@mandeepbal
mandeepbal / cft-user-data.sh
Created May 16, 2019 15:16
Cloudformation Launch Config - send user-data to aws system log
Resources:
LaunchConfig:
Type: AWS::AutoScaling::LaunchConfiguration
Properties:
IamInstanceProfile: !FindInMap [ EnvironmentMap, !Ref ParamEnvironment, InstanceProfile ]
ImageId: !Ref ParamInstanceAMI
InstanceType: !FindInMap [ EnvironmentMap, !Ref ParamEnvironment, InstanceType ]
SecurityGroups: !FindInMap [EnvironmentMap, !Ref ParamEnvironment, SecurityGroups]
UserData:
Fn::Base64: !Sub
@mandeepbal
mandeepbal / test
Created December 19, 2017 12:53
test
test
dash_id=xxxx
api_key=xxx
app_key=xxx
# 1. export
curl -X GET "https://app.datadoghq.com/api/v1/dash/${dash_id}?api_key=${api_key}&application_key=${app_key}" > dash.json
# 2. edit dash.json
move "graphs", "title", "description" up one level in the json hierarchy, from being beneath "dash" to being at the same level
@mandeepbal
mandeepbal / gist:3448eaa6dee9468dbe4dc5470323ca1e
Created June 10, 2016 22:53
List of All AWS East-1 & West-2 RSS feeds for Slack Feed Subscription
/feed subscribe http://status.aws.amazon.com/rss/aml-us-east-1.rss
/feed subscribe http://status.aws.amazon.com/rss/analytics-us-east-1.rss
/feed subscribe http://status.aws.amazon.com/rss/apigateway-us-east-1.rss
/feed subscribe http://status.aws.amazon.com/rss/apigateway-us-west-2.rss
/feed subscribe http://status.aws.amazon.com/rss/appstream-us-east-1.rss
/feed subscribe http://status.aws.amazon.com/rss/autoscaling-us-east-1.rss
/feed subscribe http://status.aws.amazon.com/rss/autoscaling-us-west-2.rss
/feed subscribe http://status.aws.amazon.com/rss/awsiot-us-east-1.rss
/feed subscribe http://status.aws.amazon.com/rss/awsiot-us-west-2.rss
/feed subscribe http://status.aws.amazon.com/rss/awswaf.rss
InfluxSrv:
image: "tutum/influxdb:0.8.8"
ports:
- "8083:8083"
- "8086:8086"
expose:
- "8090"
- "8099"
environment:
- PRE_CREATE_DB=cadvisor
@mandeepbal
mandeepbal / gist:d0c0a23e4707d2da9a75
Last active August 31, 2015 03:55 — forked from garnaat/gist:5154370
Configure a internet-connected VPC from scratch
import boto.vpc
import time
REGION_NAME = 'us-west-2'
AMI_ID = 'ami-8e27adbe' # Amazon Linux AMI
conn = boto.vpc.connect_to_region(REGION_NAME)
# Create a VPC
vpc = conn.create_vpc('10.0.0.0/16')