Skip to content

Instantly share code, notes, and snippets.

@hriad
hriad / HashidsDoctrineParamConverter.php
Created August 6, 2021 20:52 — forked from artyuum/HashidsDoctrineParamConverter.php
A ParamConverter to use HashIds with Doctrine + Symfony.
<?php
namespace App\ParamConverter;
use Doctrine\ORM\EntityManagerInterface;
use Hashids\HashidsInterface;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Sensio\Bundle\FrameworkExtraBundle\Request\ParamConverter\ParamConverterInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
@hriad
hriad / floating-ip-gateway.sh
Created October 16, 2018 11:08 — forked from sparkcodeuk/floating-ip-gateway.sh
Digital Ocean floating IP gateway script (force droplet to use the assigned floating IP for outbound traffic as well as inbound traffic)
#!/bin/bash
# Force outbound traffic through the attached floating IP
NET_INT="eth0"
CURL_TIMEOUT=3
echo -n "Setting floating IP as the default gateway: "
# Check there's a floating IP attached to this droplet
if [ "$(curl -s --connect-timeout $CURL_TIMEOUT http://169.254.169.254/metadata/v1/floating_ip/ipv4/active)" != "true" ]; then
@hriad
hriad / resize.sh
Created November 11, 2016 19:38 — forked from mifix/resize.sh
LXD - ZFS - resize
# make sure zfs autoexpand is enabled (only needed once)
sudo zpool set autoexpand=on lxd
sudo truncate -s 50G /var/lib/lxd/zfs.img
# Make zfs realize the fact that partition has been changed and make zpool
# use the new partition which is actually the same one
sudo zpool online -e lxd /var/lib/lxd/zfs.img /var/lib/lxd/zfs.img
@hriad
hriad / disable_tracker.sh
Created September 4, 2016 23:25 — forked from DanyHenriquez/disable_tracker.sh
Disable tracker Ubuntu 16.04
echo -e "\nHidden=true\n"|sudo tee --append /etc/xdg/autostart/tracker-extract.desktop
echo -e "\nHidden=true\n"|sudo tee --append /etc/xdg/autostart/tracker-miner-apps.desktop
echo -e "\nHidden=true\n"|sudo tee --append /etc/xdg/autostart/tracker-miner-fs.desktop
echo -e "\nHidden=true\n"|sudo tee --append /etc/xdg/autostart/tracker-miner-user-guides.desktop
echo -e "\nHidden=true\n"|sudo tee --append /etc/xdg/autostart/tracker-store.desktop
gsettings set org.freedesktop.Tracker.Miner.Files crawling-interval -2
gsettings set org.freedesktop.Tracker.Miner.Files enable-monitors false
tracker reset --hard
@hriad
hriad / gist:6cdfb65dd3302fef79cb
Created November 23, 2015 01:41
Fix bumblebee on HP laptops
### This issue is caused by an unusually high device bus id
### Credit to cttan https://forum.porteus.org/viewtopic.php?f=117&t=4648
cp /usr/sbin/bumblebeed{,.orig}
sed -i 's/PCI:%02x:%02x:%o/PCI:%02d:%02d:%d/' /usr/sbin/bumblebeed