Skip to content

Instantly share code, notes, and snippets.

View Nixes's full-sized avatar
🤖
🐲

Callum Bryant Nixes

🤖
🐲
View GitHub Profile
@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 / 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 / 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 / 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"
@Nixes
Nixes / Installing atom php-integrator on windows
Last active December 1, 2017 06:38
Installing atom php-integrator on windows
Installation is a bit harder than unix but absolutely worth it.
1) Install composer using windows installer
2) enable extension=php_pdo_sqlite.dll in php.ini
3) start atom and watch it fail to install php-integrator
4) run composer install --no-dev from core folder. something like C:\Users\<username>\.atom\packages\php-integrator-base\core\3.0.0
5) enjoy excellent php IDE
@Nixes
Nixes / gist:d39f7a795554c9dd7133e40178329c8a
Created February 19, 2017 07:05
Scarab OSD mini minimosd calibration
These were determined with a cheap crappy multimeter. Hopefully they save someone some time :)
Main voltage adjust: 211
Precision +- 0.5v