Skip to content

Instantly share code, notes, and snippets.

@shreeve
shreeve / ssl-certs.sh
Last active June 13, 2024 12:48
Self signing certificate script
#!/bin/bash
# =============================================================================
# ssl-certs.sh - Self signing SSL certificates
#
# Author: Steve Shreeve <[email protected]>
# Date: Dec 17, 2022
# =============================================================================
# Use https://gist.github.com/shreeve/3358901a26a21d4ddee0e1342be7749d
function useAbortController() {
const abortControllerRef = React.useRef()
const getAbortController = React.useCallback(() => {
if (!abortControllerRef.current) {
abortControllerRef.current = new AbortController()
}
return abortControllerRef.current
}, [])
React.useEffect(() => {
@ihpr
ihpr / PaginateNativeQuerySubscriber.php
Last active July 16, 2024 12:52
How to handle a NativeQuery for the KNP paginator
<?php
declare(strict_types=1);
namespace AppBundle\EventSubscriber;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\NativeQuery;
use Doctrine\ORM\NonUniqueResultException;
use Doctrine\ORM\Query\ResultSetMapping;
@ansemjo
ansemjo / container-systemd-autologin.conf
Created April 26, 2019 10:53
enable root autologin when starting a container with systemd init
# drop-in override to fix and enable autologin in rootless containers with systemd init
# e.g.:
#
# podman run --rm -it \
# -v .../container-systemd-autologin.conf:/etc/systemd/system/console-getty.service.d/override.conf:ro \
# centos:latest /usr/lib/systemd/systemd
[Service]
ExecStart=
ExecStartPre=-/usr/bin/sed -i '/pam_loginuid.so/d' /etc/pam.d/login
@ceekz
ceekz / gmail.css
Created March 30, 2017 12:46
Chrome Stylist
/* mail.google.com */
table img[title*=".zip" i], table img[title*=".rar" i], table img[title*=".gz" i], table img[title*=".tar" i], table img[title*=".bz2" i] {
width:0px!important; height:0px!important; padding-left:16px!important; padding-top:16px!important; background-position: top left !important;background-image: url(https://ssl.gstatic.com/docs/doclist/images/mediatype/icon_1_archive_x16.png) !important;
}
table img[title*=".txt" i], table img[title*=".rtf" i], table img[title*=".csv" i], table img[title*=".tsv" i] {
width:0px!important; height:0px!important; padding-left:16px!important; padding-top:16px!important; background-position: top left !important; background-image:url(https://ssl.gstatic.com/docs/doclist/images/mediatype/icon_1_text_x16.png) !important;
}
table img[title*=".c" i], table img[title*=".pl" i], table img[title*=".sql" i] {
width:0px!important; height:0px!important; padding-left:16px!important; padding-top:16px!important; background-position: top left !important; background-
![Иллюстрация к проекту](https://github.com/jon/coolproject/raw/master/image/image.png)
![Image alt](https://github.com/{username}/{repository}/raw/{branch}/{path}/image.png)
{username} — ваш ник на ГитХабе;
{repository} — репозиторий где хранятся картинки;
{branch} — ветка репозитория;
{path} — путь к месту нахождения картинки.
@fntlnz
fntlnz / self-signed-certificate-with-custom-ca.md
Last active May 3, 2025 08:56
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@lanrat
lanrat / NetworkManager.conf
Created July 12, 2016 01:19
NetworkManager ignore docker, virtualbox, and vmware adapters
[main]
plugins=ifupdown,keyfile
[ifupdown]
managed=false
[keyfile]
unmanaged-devices=interface-name:docker0;interface-name:vmnet1;interface-name:vmnet8;interface-name:vboxnet0
@mdenson-dayspring
mdenson-dayspring / ClientEnvironmentListener.php
Created January 18, 2014 01:45
Pieces parts used to retrieve the browser time zone to a Symfony 2.3/Propel web application. By using these pieces you can get and display dates and times in the users timezone and store them in them correctly so that they can be displayed correctly in another users timezone.
<?php
namespace MyApp\MyBundle\EventListener;
use DateTimeZone;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
use Symfony\Component\HttpFoundation\Cookie;
use Symfony\Component\DependencyInjection\ContainerInterface;
class ClientEnvironmentListener {