Skip to content

Instantly share code, notes, and snippets.

View Nixes's full-sized avatar
🤖
🐲

Callum Bryant Nixes

🤖
🐲
View GitHub Profile
@Nixes
Nixes / current_language_preferences.md
Last active December 17, 2021 04:01
current language preferences

General Purpose languages

  • C# (.net core only)
    • Language itself is absolute favorite, has fixed nullability problem in recent versions of c# (8.0+).
    • Open source ecosystem is a bit immature (only recently open sourced), could be very good in another 5 years.
    • Real unrestricted multithreading
  • Kotlin
    • Basically Java++
  • Second best to C#, but has some strange design decisions like removal of static methods.
@Nixes
Nixes / create_use_git_deploy_key.md
Created May 10, 2021 04:14
create and add ssh based git deploy key

Guide to create and use ssh key based git deployment

  1. Generate key with ssh-keygen, as path enter the same as suggested with a different filename of 'git'
  2. run sudo nano ~/.ssh/config and add contents like
# add bitbucket deployment key to identity file
Host bitbucket.org
    User git
    IdentityFile ~/.ssh/git
@Nixes
Nixes / MessageOnRejectionSubscriber.php
Last active April 20, 2021 07:12
symfony event handler that runs when a message has been rejected (all retries attempted and failed)
<?php
class MessageOnRejectionSubscriber implements EventSubscriberInterface {
public function onMessageFailed(WorkerMessageFailedEvent $event) {
// return early if there is still more retrying to do
if ($event->willRetry()) {
return;
}
$envelope = $event->getEnvelope();
@Nixes
Nixes / libserialport example.c
Last active February 25, 2021 02:55
libserialport example
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <unistd.h> // for sleep function
#include <libserialport.h> // cross platform serial port lib
const char* desired_port = "COM8";
@Nixes
Nixes / docker-compose.yml
Created August 28, 2020 06:46
phpmyadmin docker compose with reasonable security defaults. Will be accessible on port 443 after starting.
phpmyadmin:
image: bitnami/phpmyadmin
container_name: phpmyadmin
environment:
- PHPMYADMIN_ALLOW_ARBITRARY_SERVER=yes
- DATABASE_ENABLE_SSL=yes
restart: always
ports:
- 443:8443
@Nixes
Nixes / convert-tensorflow-model-to-tensorboard-logs.py
Created March 9, 2020 23:44
convert tensorflow model to tensorboard logs
# last tested with tensorflow 2.1.0
import tensorflow as tf
LOG_DIR = 'logs' # The path where you want to save tensorboard events
tf.compat.v1.disable_eager_execution()
with tf.compat.v1.Session() as sess:
model_filename = 'frozen_inference_graph.pb' # your model path
with tf.compat.v1.gfile.FastGFile(model_filename, 'rb') as f:
@Nixes
Nixes / silex_to_symfony_routes_migrate.php
Last active February 4, 2020 04:17
Script that generates a symfony compatible routes.php file from an existing silex application for migration, including middlewares
#!/usr/bin/env php
<?php
/***
* Dumps routes from silex route registation to yaml file for use with symfony
run with php silex_to_symfony_routes_migrate.php > ../app/routes.php
*/
use Silex\Application;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCompiler;
use Symfony\Component\Yaml\Yaml;
@Nixes
Nixes / Easy SQLite Gogs Installation for Ubuntu and Debian.md
Last active August 3, 2019 12:34
Easy SQLite Gogs Installation for Ubuntu and Debian

This is a tutorial that describes how to set up a private git (github) server for a smallish development team.

  • Download GOGS binary Zip File
  • Unzip to folder
  • Run: sudo apt-get install sqlite3
  • Run GOGS: ./gogs web
  • Goto install page: http://hostname:3000/install
  • Set to use sqlite3 as the database backend
  • Set USER to run as, preferrably not root if it will be internet facing.
  • Set Database file location (Make sure database file location is set to a folder where that same user has write permissions)
@Nixes
Nixes / update-gogs.sh
Last active May 6, 2018 02:45
Update gogs server, requires all paths to be set to gogs-data folder
echo "Downloading update"
curl -s -L https://github.com/gogits/gogs/releases/latest | egrep -o '/gogits/gogs/releases/download/[v][0-9\.]*\/raspi2_armv6.zip' | wget --base=http://github.com/ -i - -O gogs-latest.zip
echo "Stopping gogs service"
sudo service gogs stop
echo "Starting backup"
today=`date +%Y-%m-%d.%H:%M:%S`
zip -r gogs-backup-$today.zip gogs gogs-data
echo "Moving config to tmp directory"
cp -r gogs/custom gogs-custom-tmp
echo "Deleting original gogs folder"