Skip to content

Instantly share code, notes, and snippets.

@andsens
andsens / bootstrap_homeshick.sh
Last active December 27, 2023 12:47
Script that can set up an entire user account with homeshick automatically
#!/bin/bash -ex
# Paste this into ssh
# curl -sL https://gist.github.com/andsens/2913223/raw/bootstrap_homeshick.sh | tar -xzO | /bin/bash -ex
# When forking, you can get the URL from the raw (<>) button.
### Set some command variables depending on whether we are root or not ###
# This assumes you use a debian derivate, replace with yum, pacman etc.
aptget='sudo apt-get'
chsh='sudo chsh'
@beregond
beregond / gist:4373142
Last active February 7, 2022 14:41
Allows to abandon necessity to define all setters and getters in Doctrine's entities (works perfectly with Symfony + Doctrine + Twig).
<?php
namespace Vendor\TestBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
/**
* Gneral class for all entities.
*/
@mubeeniqbal
mubeeniqbal / snp
Last active June 8, 2021 14:43 — forked from cmlsharp/snp
Runs a command wrapped with snapper pre-post snapshots for btrfs subvolumes. File path: /usr/local/bin
#!/usr/bin/env bash
#
# Runs a command wrapped with snapper pre-post snapshots for btrfs subvolumes.
# Usage: snp [-c config1,config2,...] <command>
# Constants
readonly LOG_PATH='/var/local/log/snp'
readonly DATE="$(date +'%Y-%m-%d-%H%M%S')"
readonly LOG_FILE="${LOG_PATH}/snp-${DATE}.log"
@mmasaki
mmasaki / iperf.service
Last active August 14, 2023 19:42
systemd service unit for iperf
# /etc/systemd/system/iperf.service
[Unit]
Description=iperf server
After=syslog.target network.target auditd.service
[Service]
ExecStart=/usr/bin/iperf -s
[Install]
WantedBy=multi-user.target
@fprochazka
fprochazka / composer.php.ini
Last active June 14, 2022 15:09
Composer with different ini or with different PHP
[php]
memory_limit = -1
max_execution_time = 0
date.timezone = "Europe/Prague"
realpath_cache_size = "4096K"
[opcache]
opcache.enable = 1
opcache.enable_cli = 1
opcache.memory_consumption = 256
@pierrejoubert73
pierrejoubert73 / markdown-details-collapsible.md
Last active November 16, 2024 22:55
How to add a collapsible section in markdown.

How to add a collapsible section in markdown

1. Example

Click me

Heading

  1. Foo
  2. Bar
    • Baz
  • Qux
@yann-eugone
yann-eugone / EntityTranslatorStrategy.php
Last active August 13, 2018 07:49
Automatically Register Sonata Admin services
<?php
namespace App\Admin\Translator;
use Sonata\AdminBundle\Translator\LabelTranslatorStrategyInterface;
class EntityTranslatorStrategy implements LabelTranslatorStrategyInterface
{
/**
* @var string
@netravnen
netravnen / rslsync-ufw.sh
Last active January 29, 2024 11:59 — forked from auipga/rslsync-ufw.sh
Help configuring ufw for Resilio Sync (rslsync)
#!/bin/bash
# Author: https://gist.github.com/auipga/
# Based on:
# Sync (outdated?): https://kb-archive.getsync.com/kbs/1.3.5/kb/hc/en-us/articles/210153106-Ports-and-protocols-used-by-Resilio-Connect.html
# Resilio Connect: https://help.getsync.com/hc/en-us/articles/204754759-What-ports-and-protocols-are-used-by-Sync-
# todo: read sync.conf from resilio server, parse json, fill IPs dynamically
# todo: delete duplicate rules as 'host' returns multiple IPs for resilios domains