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: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
@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 / manageiq.sh
Last active April 2, 2020 10:22
ManageIQ Install
#Based on : http://manageiq.org/community/install-from-source/
#Launch a CentOS AMI from AWS (ami-8997afe0), m3.large, 20GB root mount
#Update the VM
yum update -y
yum install -y wget vim telnet git
service iptables stop
#Create User
useradd miqbuilder
@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 / elkinstall.sh
Last active October 13, 2018 01:47
ELK install
yum install -y telnet vim wget
yum install -y java-1.7.0-openjdk
rpm --import http://packages.elasticsearch.org/GPG-KEY-elasticsearch
cat <<EOF > /etc/yum.repos.d/elasticsearch.repo
[elasticsearch-1.4]
name=Elasticsearch repository for 1.4.x packages
baseurl=http://packages.elasticsearch.org/elasticsearch/1.4/centos
gpgcheck=1
gpgkey=http://packages.elasticsearch.org/GPG-KEY-elasticsearch
enabled=1
@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