Skip to content

Instantly share code, notes, and snippets.

View cgddrd's full-sized avatar

Connor Goddard cgddrd

View GitHub Profile
@cgddrd
cgddrd / test.svg
Created March 20, 2020 11:36
test.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cgddrd
cgddrd / uk-postcode-areas.geojson
Created January 14, 2020 13:02
uk-postcode-areas.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cgddrd
cgddrd / postcodes.geojson
Created January 14, 2020 11:54
postcodes.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cgddrd
cgddrd / pandas-group-by-date-and-category.py
Created October 24, 2018 15:12
Pandas - Group by date and categorical column
import pandas as pd
# 'reset_index' is required to turn a multi-level index back into columns.
df.groupby([pd.Grouper(key='my_date_column', freq='1D'), 'my_categorical_column']).count().reset_index()
@cgddrd
cgddrd / Powershell - Switch Docker Engine.md
Last active June 27, 2018 07:15
Powershell - Switch Docker Engine

Powershell - Switch Docker Engine

You can use the following command in Powershell to switch the Docker daemon engine between Windows and Linux:

& 'C:\Program Files\Docker\Docker\DockerCli.exe' -SwitchDaemon
@cgddrd
cgddrd / docker_registry_v2_manage.py
Created May 22, 2018 12:18
docker_registry_v2_manage.py
import requests
REGISTRY_URL = "http://<HOST>/v2/"
proxies = {
"http": None,
"https": None,
}
def get_repositories():
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Poller
@cgddrd
cgddrd / uninstall_msi_product_key_lookup.bat
Created January 21, 2017 20:35
Performs silent uninstall of an MSI application via product key lookup from supplied application name wildcard.
@echo off
rem Uninstall MSI application via Product-Key GUID Lookup.
rem Modified from original source: http://stackoverflow.com/q/30790561
rem Extract Product Key GUID for provided product name wildcard ('%%b'), before performing silent uninstall.
for /f "skip=1 delims=" %%a in (
'wmic product where "Name like '%%INSERT_PRODUCT_NAME_WILDCARD%%'" get identifyingnumber'
) do @for /f "delims=" %%b in ("%%a") do msiexec /x %%b /qb
@cgddrd
cgddrd / Install_Parallels_11_Tools_Ubuntu_Server_16.04.md
Last active June 2, 2016 06:34 — forked from magnetikonline/README.md
Install OSX Parallels version 10 / 11 tools on Ubuntu server guest.

Install OSX Parallels version 10 / 11 tools on Ubuntu server guest

  • Create Ubuntu server instance under Parallels (obviously).

  • Start VM, goto Actions - Install Parallels Tools... to mount the ISO image.

    • Note: if this fails, or updating tools for an existing guest you can do the following:
    • Goto Devices > CD/DVD 1 > Connect Image....
    • Select the following ISO image: /Applications/Parallels Desktop/Contents/Resources/Tools/prl-tools-lin.iso.
    • This will mount the tools CD image.
  • From the terminal, run the following commands:

public class StochasticUniversalSampling {
/**
*
* @param population - set of individuals' segments. Segment is equal to individual's fitness.
* @param n - number of individuals to choose from population.
* @return set of indexes, pointing to the chosen individuals in the population set
*/
public int[] execute(double[] population, int n) {
// Calculate total fitness of population