Skip to content

Instantly share code, notes, and snippets.

View bamdadd's full-sized avatar

Bamdad Dashtban bamdadd

View GitHub Profile
@bamdadd
bamdadd / inventory_check.py
Last active October 19, 2021 08:56
Apple UK iphone 13 inventory check
from time import sleep
import mac_say
import requests
from pprint import pprint
def is_available(y):
return y[1] != 'unavailable'
@bamdadd
bamdadd / prometheus_flask.py
Last active September 10, 2021 10:15
Flask and Prometheus custom metrics examples
import random
import argparse
import time
import traceback
from concurrent.futures.thread import ThreadPoolExecutor
from flask import Flask
from prometheus_flask_exporter import PrometheusMetrics
from prometheus_client import Gauge, Counter, Histogram, Info, Enum
### Keybase proof
I hereby claim:
* I am bamdadd on github.
* I am bamdad (https://keybase.io/bamdad) on keybase.
* I have a public key ASA7QeoegQZeA2QB2Ie752tOPhiLMCPoLm88S96A4_mO4wo
To claim this, I am signing this object:
function exit_code {
local OUTPUT="$(docker ps -n 1 --format '{{.Status}}' | tr "\(" " " | tr "\)" " " | awk '{print $2}')"
exit ${OUTPUT:1:1}
}
docker ps ubuntu /bin/true
exit_code
docker ps ubuntu /bin/false
exit_code
@bamdadd
bamdadd / ec2_launch_config.py
Created May 10, 2016 11:34
Fixed ec2_lc with broken user-data (whitespaces) to be used with cloud-init or bash scripts ( This is a hack ) We should actually fix boto library
#!/usr/bin/python
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@bamdadd
bamdadd / velocity.md
Last active August 29, 2015 14:06 — forked from guenter/velocity.md
[23/Sep/2013 11:37:55] "POST /news/zero-commissions HTTP/1.0" 200 - 0.5180
Warning: Permanently added 'github.com,192.30.252.131' (RSA) to the list of known hosts.
From github.com:www-thoughtworks-com/tw.integration.content
e935312..a4870d4 master -> origin/master
You are not currently on a branch. Please specify which
branch you want to rebase against. See git-pull(1) for details.
git pull <remote> <branch>
error: Ref refs/remotes/origin/master is at a4870d4362bfdceda3a33bd49ee5563178b86584 but expected e935312b4ef5eb831a13dcf1c5cdfbe0c50