Skip to content

Instantly share code, notes, and snippets.

View MortenDHansen's full-sized avatar

Morten D. Hansen MortenDHansen

View GitHub Profile
@MortenDHansen
MortenDHansen / install-supervisor.sh
Created October 3, 2023 08:32
Install supervisor on Amazon Linux 2023 (al2023 elastic beanstalk)
#!/bin/bash
echo "Supervisor - starting setup"
. /opt/elasticbeanstalk/deployment/env
if ! command -v supervisord &> /dev/null
then
echo "installing supervisor"
sudo yum update -y && sudo yum install python3 python3-pip -y
sudo pip install supervisor
@MortenDHansen
MortenDHansen / DefaultKeyBinding.dict
Last active December 2, 2020 13:48
Make a reasonable key binding for home and end on mac osx
/*
File should be located: ~/Library/KeyBindings/DefaultKeyBinding.dict
Nobody in the history of the world, and in the future to come, would think it makes sense that home and end buttons on mac behaves like they were Page up and Page down. Nobody.
And it seems nobody at the almighty, all-knowing, we-tell-you-what-YOU-want corporation Apple thought it was an idea to make a choice available...
This fixes it:
*/
@MortenDHansen
MortenDHansen / rmdc.fish
Last active July 16, 2019 17:31
Fish Shell remove all stopped docker containers (rmdc)
function rmdc
docker rm (docker ps -a -q)
end
@MortenDHansen
MortenDHansen / simpleWriteLogToFileMethod.php
Created June 9, 2017 09:23
Simple method for writing info to log
/**
* @param string $type
* @param $msg
*/
public function localLog($msg, $type = 'performance')
{
switch ($type) {
case 'performance':
$logMsg = date("Y-m-d H:i:s") . " | " . $msg . " | " . PHP_EOL;
@MortenDHansen
MortenDHansen / ticker.go
Created February 7, 2017 21:54
GoLang ticker - every second for ... time
package main
import "time"
import "fmt"
func main() {
tickerChannel := time.NewTicker(1 * time.Second)
go func() {
for {
select {
@MortenDHansen
MortenDHansen / goCheckError.go
Created January 21, 2017 16:56
Golang error checker with err output
func checkError(err error) {
if err != nil {
fmt.Println("CRAP, Fuck me... And error occured... ", err.Error())
}
}