Skip to content

Instantly share code, notes, and snippets.

View kieraneglin's full-sized avatar
😎

Kieran kieraneglin

😎
  • British Columbia, Canada
View GitHub Profile
@kieraneglin
kieraneglin / retry-stalled-autodl-torrents.sh
Created February 26, 2024 01:40
Retry stalled fresh torrents from Autobrr/autodl-irssi in Deluge 2.x
#!/bin/bash
daemon_port=58846
# The Daemon username and password may not be the same as the web UI.
# Google "deluge daemon username password" for more info.
username=deluge
password=deluge
# If you want to only retry stalled torrents that were
# added by autobrr/autodl-irssi/etc, set `auto_dl_only` to 1
# and set `auto_dl_label` to whatever you've set up for your auto-downloader.
@kieraneglin
kieraneglin / Line_Purge.cfg
Last active November 8, 2023 23:07
KAMP macro to park at beginning of line purge
[gcode_macro LINE_PURGE]
description: A purge macro that adapts to be near your actual printed objects
gcode:
# Get relevant printer params
{% set travel_speed = (printer.toolhead.max_velocity) * 60 | float %}
{% set cross_section = printer.configfile.settings.extruder.max_extrude_cross_section | float %}
# Use firmware retraction if it is defined
{% if printer.firmware_retraction is defined %}
{% set RETRACT = G10 | string %}
@kieraneglin
kieraneglin / onelogin_instructions.md
Last active June 28, 2023 16:18
OneLogin SAML setup

1. Add SAML app in OneLogin

  1. Log in to the OneLogin Dashboard, and click Apps > Add Apps
  2. Search for SAML, and select SAML Test Connector (IdP)
  3. Set the Display Name to Percent Pledge
  4. Set the Rectangular Icon to our logo which you can find here
  5. Click Save

Screenshot 2023-04-26 at 8 55 38 AM

@kieraneglin
kieraneglin / example_live_test.exs
Last active February 11, 2024 03:44
Pow sessions with LiveView (including tests)
defmodule MyAppWeb.ExampleLiveTest do
# `LiveviewCase` is a custom test helper - pretty much the same as ConnCase but with
# import Phoenix.LiveViewTest
# import MyApp.Support.AuthHelpers
use MyAppWeb.LiveviewCase, async: false
import MyApp.Factory
alias MyApp.Repo
alias MyAppWeb.ExampleLive
@kieraneglin
kieraneglin / lyrics.csv
Created May 16, 2021 23:00
Lyrics training dataset
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
lyrics
"Fuck this world
I'm so sick of your temporary bullshit
I want the light at the end
And I know how to get it
If it takes my life then I will gladly die
Open your mind
Realise we are slaves
Forced Draconian mind-state
Open your eyes
@kieraneglin
kieraneglin / LICENSE.txt
Last active March 30, 2021 15:06
Elixir module for interfacing with DRV8825 via Nerves
_My_ portion of this code is licensed under the very permissive DWYW License (https://github.com/thornjad/DWYW).
If you are unable to recognize DWYW as a valid license, _my_ portion of this code is then licensed under MIT.
TL;DR: I don't care what you do with this, just don't get mad at me if a stepper breaks itself/something else when using this module. Liability = no. When I say "my code", I mean everything that isn't Circuits.GPIO.
The Circuits.GPIO library is licenced as such: https://github.com/elixir-circuits/circuits_gpio/blob/main/LICENSE
@kieraneglin
kieraneglin / islander_problem.ex
Last active April 5, 2019 21:36
B99 islander problem in Elixir
defmodule IslanderProblem do
@total_islanders 12
@group_size 4
# Weighs islanders 3 times, finding which islander is the outlier
#
# Returns an integer representing the weight of the outlier
def start(islanders) when is_list(islanders) do
if length(islanders) != @total_islanders do
raise ArgumentError, "There must be exactly #{@total_islanders} islanders"
extern crate rand;
use rand::Rng;
use std::time::Instant;
fn merge(l1: &Vec<i32>, s: usize, m: usize, e: usize, l2: &mut Vec<i32>) {
let mut ptr1 = s;
let mut ptr2 = m;
for i in s..e {
if (ptr1 < m) && (ptr2 >= e || l1[ptr1] <= l1[ptr2]) {
<?php
include 'router.php';
foreach (glob('controllers'.DIRECTORY_SEPARATOR.'*_controller.php') as $filename) {
// Include all php files that end with `_controller.php` in the `controllers` directory
// Note that this does not recursively include files
include $filename;
}
$router = new Router();
<?php
class Router {
private $routes = [];
public function get($pattern, $controller_method) {
$this->route('get', $pattern, $controller_method);
}
public function post($pattern, $controller_method) {