Skip to content

Instantly share code, notes, and snippets.

View rinukkusu's full-sized avatar
🎯
in the pub

Max Riegler rinukkusu

🎯
in the pub
View GitHub Profile
@rinukkusu
rinukkusu / ZippedCsvReader.cs
Last active August 21, 2021 06:25
Helper class to read CSV files from a ZIP archive
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Net.Http;
using System.Threading.Tasks;
using CsvHelper; // see https://joshclose.github.io/CsvHelper/
namespace ZippediZap
@jonico
jonico / docker-build-publish.yaml
Created August 19, 2019 07:22
Build docker image and push to GPR with GitHub Actions
name: Build and publish Jekyll Docker image for Octocat Generator
on: [push]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: clean up, docker login && docker build && docker push
@simonwhatley
simonwhatley / GoogleDistance.gs
Last active October 3, 2024 17:11
Get the distance between 2 addresses in Google Sheets using Google Maps
/**
* Get the distance between 2 different addresses.
* @param {string} origin_address The origin/start address as string Eg. "102 Petty France, London, SW1H 9AJ".
* @param {string} destination_address The destination/end address as string Eg. "10 Whitechapel High Street, London, E1 8QS".
* @param {string} travel_mode The mode of travel as string. Default: DRIVING. Options: BICYCLING, TRANSIT, WALKING.
* @param {string} return_type The return type as string. Default: MILES. Options: KILOMETERS, MINUTES, HOURS, STEPS.
* @return the distance between 2 different addresses.
* @customfunction
*/
function GOOGLEDISTANCE(origin_address,destination_address,travel_mode,return_type) {
@kieranmv95
kieranmv95 / _spacing-helper.scss
Last active February 6, 2019 02:10
Generates a array of spacing helper classes for margin and padding
// Customisable spacing units. these can be changed and new ones added
$spacing-units: (
1: 3px,
2: 5px,
3: 8px,
4: 13px,
5: 21px,
);
// These will not change this is just to help generate the classes with the correct naming
function walkScope(scope) {
function processLevel(scope, idCache) {
if (scope == null)
return null;
if (idCache.indexOf(scope.$id) >= 0)
return null;
idCache.push(scope.$id);
@foofoodog
foofoodog / Octo.cs
Last active January 22, 2022 09:25
Read only C# wrapper for OctoPrint API
/*
// OctoPrint API wrapper
// csc /target:library Octo.cs /r:System.Net.Http.dll
// linqpad
var server = "http://localhost:5000";
// print3r.Reader<print3r.Logs.Result>.Read(server).Dump();
// print3r.Reader<print3r.Connection.Result>.Read(server).Dump();
// print3r.Reader<print3r.Files.Result>.Read(server).Dump();
// print3r.Reader<print3r.Job.Result>.Read(server).Dump();
// print3r.Reader<print3r.Printer.Result>.Read(server).Dump();
@Saanch
Saanch / StructureMapJobFactory.cs
Last active December 6, 2018 11:27
StructureMapJobFactory Quartz.net IoC using StructureMap
public class StructureMapJobFactory : IJobFactory
{
private static readonly ILog Logger = LogProvider.GetCurrentClassLogger();
private readonly IContainer _container;
public StructureMapJobFactory(IContainer container)
{
this._container = container;
}
@myusuf3
myusuf3 / delete_git_submodule.md
Created November 3, 2014 17:36
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@jhgbrt
jhgbrt / GZipCompressDecompress.cs
Last active February 22, 2023 16:02
C# gzipstream
public static byte Compress(string text)
{
using (var ms = new MemoryStream())
{
using (var zip = new GZipStream(ms,
CompressionMode.Compress))
using (var writer = new StreamWriter(zip, Encoding.UTF8))
{
writer.Write(text);
}
@christopher-hopper
christopher-hopper / vm-resize-hard-disk.md
Last active August 15, 2024 15:16
Resize a Hard Disk for a Virtual Machine provisioned using Vagrant from a Linux base box to run using VirutalBox.

Resize a Hard Disk for a Virtual Machine

Our Virtual Machines are provisioned using Vagrant from a Linux base box to run using VirutalBox. If the Hard Disk space runs out and you cannot remove files to free-up space, you can resize the Hard Disk using some VirtualBox and Linux commands.

Some assumptions

The following steps assume you've got a set-up like mine, where: