Skip to content

Instantly share code, notes, and snippets.

View alanmbarr's full-sized avatar
🌴
On vacation

Alan Barr alanmbarr

🌴
On vacation
View GitHub Profile
@alanmbarr
alanmbarr / weightedavg.py
Last active May 24, 2020 11:00
Determine weighted average for hotel ratings
# http://times.cs.uiuc.edu/~wang296/Data/ tripadvisor dataset
import json
import numpy as np
import os
path = '/place/i/have/lots/of/json'
np.seterr(divide='ignore', invalid='ignore')
np.set_printoptions(nanstr="0")
#loop over all files in dir
for filename in os.listdir(path):
with open(path+filename) as json_file:
@alanmbarr
alanmbarr / sitemapgenerator.php
Created October 12, 2016 20:31
Generate the sitemap for my website
#!/usr/bin/env php
<?
function getDirContents($dir, &$results = array()){
$files = scandir($dir);
foreach($files as $key => $value){
if($value == ".git"){
continue;
}
@alanmbarr
alanmbarr / ReplaceReferences.ps1
Last active December 12, 2017 19:55 — forked from shiranGinige/ChangeAllReferences.ps1
Powershell script to changes references of all projects under the execution directory
#ReplacePackage -ReferenceToRemove $encompasspkg -VersionNumber $versionSDK
function ReplacePackage(){
param([String]$ReferenceToReplace, [String]$VersionNumber)
$xmlns = "http://schemas.microsoft.com/developer/msbuild/2003"
$projects = ls -r -i *.csproj
foreach($projectPath in $projects)
{
void Main()
{
//For current month dump data about each bug: descript
var teamsValid = new List<int> { 3, 4, 5, 6, 7, 9, 10, 11, 12, 17, 18, 19 };
var teams = from t in Teams
where t.Id != 1
select new
{
t.Id,
@alanmbarr
alanmbarr / distortimages.py
Last active November 8, 2018 04:23
take pdfs and distort them with imgaug
import imageio, glob
import PyPDF2
from wand.image import Image
from wand.color import Color
import numpy
import imgaug as ia
from imgaug import augmenters as iaa
import numpy as np
import cv2