Skip to content

Instantly share code, notes, and snippets.

View Nixes's full-sized avatar

Callum Bryant Nixes

View GitHub Profile
@Nixes
Nixes / sentry_post_init_set_release.md
Last active October 4, 2024 05:48
Method of setting the sentry release value after Sentry init has already completed

Check the scopes that you want to set it in, in my case I want it set for the entire application lifespan, so I set it in all possible scopes (to also effect scopes in flight).

export const setPostInitRelease = (releaseName: string) => {
    // set the release value using an event processor
    const eventProcessor = (event: { release: string | undefined }) => {
        event.release = releaseName
        return event
    };
 Sentry.getGlobalScope().addEventProcessor(eventProcessor)
@Nixes
Nixes / sentry self-hosted uninstall.md
Created September 4, 2024 13:56
Uninstall sentry self hosted

Run within the repo that you cloned the self-hosted repository

sudo docker compose down --volumes

Then delete the folder you cloned the self-hosted repository to

sudo rm -R self-hosted
@Nixes
Nixes / create_use_git_deploy_key.md
Last active May 21, 2024 06:25
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"