Skip to content

Instantly share code, notes, and snippets.

View ghandic's full-sized avatar

Andy Challis ghandic

View GitHub Profile
@ghandic
ghandic / fast_call.sh
Last active May 17, 2018 08:08
Run cURL request x times in one line
FAST_CALLS_N=200
FAST_CALLS_URL=http://0.0.0.0:8686/api/v1/scores
seq $FAST_CALLS_N | xargs -Iz curl -X GET $FAST_CALLS_URL
@ghandic
ghandic / find_all_app_urls.py
Created May 8, 2018 10:58
Finds all available custom app url strings, for example if you paste and run this github link in your browser x-github-client://openRepo/https://github.com/ghandic/facial_analysis_api
import plistlib
import glob
import json
import os
app_urls=[]
for app in glob.glob('/Applications/*.app'):
urls=[]
for pl in glob.glob(os.path.join(app, 'contents/Info.plist')):
try:
@ghandic
ghandic / hello.sh
Last active May 3, 2018 14:31
Say Hello in every voice on the mac
hi -v '?' | awk '{print $1}' | xargs -I{} say -v {} Hello my name is {}
@ghandic
ghandic / docker_remove_none_images.sh
Created March 13, 2018 13:34
Remove all docker images with the "none" tag
docker rmi -f $(docker images -f "dangling=true" -q)
@ghandic
ghandic / latest_blame.go
Last active March 8, 2018 17:04
My first play around with go, so I converted my latest_blame.py to go
// Simply run this executable with the file url inside github and it will find the most recent blame on the file
// Env:
// docker run -it golang:1.8
// Install:
// mkdir -p $GOPATH/src/github.com/user/latest_blame
// curl https://gist.githubusercontent.com/ghandic/dcfd6ac55cdc1a20e1bd12f3e7429f88/raw/latest_blame.go > $GOPATH/src/github.com/user/latest_blame/latest_blame.go
// go get github.com/anaskhan96/soup
// go install github.com/user/latest_blame
// Use:
// latest_blame --url https://github.com/ghandic/confluenceapi/blob/master/README.md
@ghandic
ghandic / big_fake.py
Last active March 1, 2018 13:15
Parallelizing the creating of large fake data sets, 1 million records in 60 seconds on 4 cpu, 16gb ram
import numpy as np
import pandas as pd
from faker import Factory
from multiprocessing import Pool, cpu_count
faker = Factory.create()
def create_fake_data(data):
data['full name'] = data['id'].map(lambda _:faker.name())
data['date of birth'] = data['id'].map(lambda _:faker.date_between('-100y', 'now'))
from bs4 import BeautifulSoup
from datetime import datetime
def get_most_recent_git_change_for_file(url):
"""
Parameters:
----------
url: str, the url to where the github file is stored
@ghandic
ghandic / keybase.md
Created December 15, 2017 15:22
keybase verification

Keybase proof

I hereby claim:

  • I am ghandic on github.
  • I am ghandic (https://keybase.io/ghandic) on keybase.
  • I have a public key ASDbdBfxeu8VOoUIB6o2bf6aqRQW2wgegm6F55WEQk3vUwo

To claim this, I am signing this object: