Skip to content

Instantly share code, notes, and snippets.

@willt
willt / todo.sh
Last active October 4, 2021 16:41
todo.sh
#!/bin/bash
# Add this to i3 config and put todo.sh in path
#for_window [class="TODO"] floating enable, move to scratchpad
#bindsym $mod+grave [class="TODO"] scratchpad show
#exec_always --no-startup-id /home/username/bin/todo.sh
cd $HOME
mate-terminal --working-directory=$HOME \
--hide-menubar \
--profile=TODO \
--geometry=80x24 \
@willt
willt / bubbleSort.pl
Created October 20, 2020 23:30
perl bubble sort
#!/usr/bin/perl
#
use strict;
use warnings;
use Data::Dumper;
my @numbers = qw(21 6 13 1 105 74 37);
print Dumper \@numbers;
@willt
willt / theprimeagen-recursion.pl
Last active October 6, 2020 04:12
recursion example from theprimeagen
#!/usr/bin/perl
#
use strict;
use warnings;
my $file = "./maze.txt";
my $debug = 0;
# turn off output buffering
$| = 1;
@willt
willt / shift_div.pl
Created June 28, 2020 06:55
perl divide with shift
#!/usr/bin/perl
use strict;
use warnings;
my $n = $ARGV[0];
my $d = $ARGV[1];
printf("%d / %d = %s\n", $n, $d, shift_div( $n, $d ));
sub shift_div {
@willt
willt / AddPlatformEffector2DColliderMask.cs
Created September 28, 2017 03:00
Adds a collider mask to a Platform Effector 2D
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Physics2D)]
[Tooltip("Adds a collider mask to a Platform Effector 2D")]
public class AddPlatformEffector2DColliderMask : FsmStateAction
{
@willt
willt / RemovePlatformEffector2DColliderMask.cs
Created September 28, 2017 02:59
Removes a collider mask from a Platform Effector 2d
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Physics2D)]
[Tooltip("Removes a collider mask from a Platform Effector 2d")]
public class RemovePlatformEffector2DColliderMask : FsmStateAction
{
[RequiredField]
[CheckForComponent(typeof(PlatformEffector2D))]
@willt
willt / trace.gml
Last active July 25, 2017 17:02
easy debugging in gml
/// trace(...)
var r = string(argument[0]);
for (var i = 1; i < argument_count; i++) {
r += ", " + string(argument[i])
}
show_debug_message(r)
@willt
willt / remove unicode
Created June 5, 2017 18:00
remove unicode
var str = "H¿Ñiڅ"
var new_string = ""
for (var i = 1; i <= string_length(str); i += 1)
{
var c = string_ord_at(str, i)
show_debug_message("ID: " + string(c) + " Character: " + string_char_at(str,i))
if (c < 128)
{
new_string += string_char_at(str,i)
@willt
willt / gist:5e8e661532a03ea4da8754600fe2de88
Created February 10, 2017 19:34
Custom SSL Setup on foreman/katello
I believe everything is working with a custom ssl certificate using the below config.
I did a normal install then changed the config files. I would still like to find out how to specify all
of this in the installer/answer files.
Wildcard cert purchased from comodo: star.example.com.crt, star.example.com.key
CA Bundle from comodo: ca-bundle-comodo.crt are
On foreman server:
/etc/httpd.conf/05-foreman-ssl.conf
SSLCertificateFile "/etc/pki/tls/certs/star.example.com.crt"
SSLCertificateChainFile "/etc/pki/tls/certs/ca-bundle-comodo.crt"
@willt
willt / twitch_whisper.py
Created April 21, 2016 07:27
hexchat script to add support for twitch whispers
import hexchat
__module_name__ = 'Twitch'
__module_author__ = 'Zeeawk'
__module_version__ = '1'
__module_description__ = 'Add support for whispers on Twitch.tv'
def twitchOnly(func):
def if_twitch(*args, **kwargs):
for host in (hexchat.get_info('host'), hexchat.get_info('server')):