Skip to content

Instantly share code, notes, and snippets.

View saleem-mirza's full-sized avatar
💭
Less is more

Saleem Mirza saleem-mirza

💭
Less is more
View GitHub Profile
@saleem-mirza
saleem-mirza / .tmux.conf
Last active September 2, 2021 21:45
Minimalistic tmux.conf
set -g mouse on
set -g prefix C-s
set -g default-shell "/bin/bash"
set -g default-terminal "screen-256color"
bind-key | split-window -h
bind-key - split-window -v
bind-key r source-file ~/.tmux.conf \; display '~/.tmux.cof reloaded'
bind-key y set-window-option synchronize-panes
@saleem-mirza
saleem-mirza / json_to_csv.py
Last active October 17, 2019 13:14
Convert Json to flat CSV
import pandas as pd
from pandas.io import json
from pandas.io.json import json_normalize
with open('data.json') as f:
data = json.loads(f.read())
def normalize(o):
dict_obj = {}
items = []
@saleem-mirza
saleem-mirza / jsver.go
Created July 20, 2019 19:36
Go application to version JavaScript resources in web page
/*
Copyright (c) 2019, Saleem Mirza
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
@saleem-mirza
saleem-mirza / facebook_solution.py
Created February 9, 2019 17:12
Facebook coding challenge
level = [
[10000,0.1],
[20000,0.2],
[10000,0.1],
[None, 0.4]
]
def calculate_tax(level, income):
if income <= 0:
return (0, 0)
@saleem-mirza
saleem-mirza / logger.go
Last active October 22, 2021 19:04
Azure Log Analytics Logger in Golang
package main
import (
"crypto/hmac"
"crypto/sha256"
"encoding/base64"
"net/http"
"time"
"unicode/utf8"
"strconv"
@saleem-mirza
saleem-mirza / query.js
Created February 9, 2016 04:30
MongoDB slow full text query
db.messages.find({$text:{$search:"Gillette"}}).limit(1).explain("allPlansExecution")
@saleem-mirza
saleem-mirza / explain.json
Created February 9, 2016 04:28
MongoDB Query Explain result
{
"queryPlanner" : {
"plannerVersion" : NumberInt(1),
"namespace" : "enron.messages",
"indexFilterSet" : false,
"parsedQuery" : {
"$text" : {
"$search" : "Gillette",
"$language" : "english",
"$caseSensitive" : false,
@saleem-mirza
saleem-mirza / vagrant_prep.ps1
Created October 31, 2014 00:23
PowerShell script to prepare Windows machine for vagrant
winrm quickconfig -q
winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="512"}'
winrm set winrm/config '@{MaxTimeoutms="1800000"}'
winrm set winrm/config/service '@{AllowUnencrypted="true"}'
winrm set winrm/config/service/auth '@{Basic="true"}'
Set-Service -Name WinRM -StartupType Automatic
#netsh firewall add portopening TCP 5985 "Port 5985"
#winrm set winrm/config/listener?Address=*+Transport=HTTP '@{Port="5985"}'