Skip to content

Instantly share code, notes, and snippets.

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
@xiaoxiaoyu93
xiaoxiaoyu93 / ListAllApi.php
Last active January 22, 2021 07:34
Dump/Export Matomo api Mudules & Actions to json
<?php
namespace Piwik\Plugins\CoreConsole\Commands;
use Piwik\API\DocumentationGenerator;
use Piwik\API\Proxy;
use Piwik\Plugin\ConsoleCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
@xiaoxiaoyu93
xiaoxiaoyu93 / ANSI.md
Created September 16, 2022 07:12 — forked from fnky/ANSI.md
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@xiaoxiaoyu93
xiaoxiaoyu93 / ForceUSBtoTTY.md
Created September 19, 2022 06:12 — forked from edro15/ForceUSBtoTTY.md
[How To] Force a specific USB device to a certain TTY

Scenario:

  • multiple USB devices plugged via hub to a host (Linux OS based),
  • multiple services/programs interacting with TTY running on top (e.g. GPSd)

Problem:

At boot TTY are randomly assigned to devices causing depending services/programs instabilities. They could indeed fail to start because of different TTY configurations.

Solution:

@xiaoxiaoyu93
xiaoxiaoyu93 / chrome_HSTS_clear.md
Created September 29, 2022 06:21 — forked from stollcri/chrome_HSTS_clear.md
Clear 307 HSTS redirects in Google Chrome

To clear 307 HSTS redirects in Google Chrome (if you experimenting with SSL -- you probably wouldn't want to do this for a site that you do not opperate, since it is there to protect you), go to the following URL and delete the site.

chrome://net-internals/#hsts

@xiaoxiaoyu93
xiaoxiaoyu93 / m2crypto-certificates.py
Created November 22, 2022 03:04 — forked from eskil/m2crypto-certificates.py
Example of generating CA certs and CA signed certs using python m2crypto.
"""
Tools for creating a CA cert and signed server certs.
Divined from http://svn.osafoundation.org/m2crypto/trunk/tests/test_x509.py
The mk_temporary_xxx calls return a NamedTemporaryFile with certs.
Usage ;
# Create a temporary CA cert and it's private key
cacert, cakey = mk_temporary_cacert()
@xiaoxiaoyu93
xiaoxiaoyu93 / frag.glsl
Created December 9, 2022 05:58 — forked from 983/frag.glsl
hsv rgb conversion glsl shader
// because http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl is often down
vec3 rgb2hsv(vec3 c)
{
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
float d = q.x - min(q.w, q.y);
float e = 1.0e-10;