Skip to content

Instantly share code, notes, and snippets.

View wizact's full-sized avatar
🐶
I have no idea what i'm doing

Amir Mohtasebi wizact

🐶
I have no idea what i'm doing
View GitHub Profile
@wizact
wizact / NZHNoPaywall.js
Last active June 14, 2022 07:00
Bookmarklet to remove NZHerald premium stories (behind paywall) and premium toaster from their homepage.
javascript:document.querySelectorAll("span[class='story-card__label']").forEach(a => a.parentElement.remove());document.querySelector("#premium-toaster").remove();
@wizact
wizact / gist:1662bfe735c8719ff5b089b42fda3b08
Created April 28, 2020 09:10
Calculate diff two dates in hours
import pandas as pd
df = pd.read_csv("./dates.csv")
df_length = len(df.index)
print("# Incidents: ", df_length)
df['A'] = pd.to_datetime(df["start_date"])
df['B'] = pd.to_datetime(df["end_date"])
df['MTTR'] = (df['B'] - df['A']).astype('timedelta64[h]')
print("MTTR: ", df['MTTR'].mean())
@wizact
wizact / fun.sh
Created February 5, 2020 08:07
Move cursor around
x=20
y=20
clear;
for x in {0..150}; do
y=`echo "12+6*s($x/6)"|bc -l|cut -d. -f 1`
echo -en \\033[$y\;"$(($x/2))"HX;
sleep 0.1;
done
@wizact
wizact / delete-merged-branches.sh
Created December 17, 2019 04:30
Delete all merged branches
#!/bin/bash
git checkout master
for branch_name in $(git branch --merged| egrep -v "(^\*|master|release|integrate)")
do
git tag archive/$branch_name $branch_name
git branch -d $branch_name
done
@wizact
wizact / flip.html
Created May 23, 2019 07:54
Card Flip Effect in Html & JS
<html>
<head>
<title>Flip</title>
<style>
.container {
position:relative;
width:400px;
height:400px;
{
"containerDefinitions": [
{
"name": "datacontainer",
"mountPoints": [
{
"sourceVolume": "volume-0",
"readOnly": false,
"containerPath": "/app/acmeinc-api/log/"
}
#!/usr/bin/env bash
set -e
JQ="jq --raw-output --exit-status"
deploy_image() {
# get the authorization code and login to aws ecr
autorization_token=$(aws ecr get-authorization-token --registry-ids $account_id --output text --query authorizationData[].authorizationToken | base64 --decode | cut -d: -f2)
docker login -u AWS -p $autorization_token -e none https://$account_id.dkr.ecr.us-east-1.amazonaws.com
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
fix_name() {
DOCKERFILE_NAME="Dockerfile"
if [[ $CIRCLE_BRANCH = 'release' ]]; then
DOCKERFILE_NAME="$DOCKERFILE_NAME.prod";
elif [[ $CIRCLE_BRANCH = 'test.1' ]]; then
machine:
node:
version:
0.10.33
services:
- docker
checkout:
post:
- chmod +x ./fix_dockerfile.sh && ./fix_dockerfile.sh
# Dockerizing Mongodb with ubuntu as base # Based on ubuntu:latest
FROM ubuntu:latest
MAINTAINER Amir Mohtasebi <amir.mohtasebi@gmail.com>
# Installation based on http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
RUN echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | tee /etc/apt/sources.list.d/10gen.list
# Installing mongodb-org