Skip to content

Instantly share code, notes, and snippets.

View MayMeow's full-sized avatar
🌙
Moonlit Coding Session 🌌

May MayMeow

🌙
Moonlit Coding Session 🌌
View GitHub Profile
@MayMeow
MayMeow / README.md
Created August 17, 2021 20:20 — forked from matusnovak/README.md
Matrix (Synapse + Riot) in Docker with Traefik and federation

Matrix

matrix.org chat is split into two parts, the server and the client. The server we are going to use is called Synapse and the client is Riot.im. The Synapse will also need Postgres database and Redis for caching.

0. Folders

Make sure your folder structure looks like this.

example/
@MayMeow
MayMeow / NumberConverter.php
Last active January 15, 2022 08:16
I found this on internet when i need something to shorten link... This is class but its not problem to create cakephp component... (i can post this one too if anyone want it)
<?php
class Converter {
public function convert ($number = null) {
$codeset = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
$base = strlen($codeset);
$n = $number;
$converted = "";
@MayMeow
MayMeow / send-file.php
Last active January 15, 2022 08:34
Cakephp Send string as file
<?php
public function sendIcs()
{
$icsString = $this->Calendars->generateIcs();
$response = $this->response;
// Inject string content into response body
$response = $response->withStringBody($icsString);
@MayMeow
MayMeow / add-vpn.ps1
Created January 15, 2022 08:29
Add VPN connection with Powershell
# add-l2tp.ps1
param($name, $server, $psk)
Add-VpnConnection -Name $name -ServerAddress $server -TunnelType "L2tp" -AuthenticationMethod Chap,MSChapv2,Pap -L2tpPsk $psk
@MayMeow
MayMeow / rebind.rsc
Last active January 15, 2022 08:34
Try to get new IP address when no internet on Gateway interface in Mikrotik
# Ping 6 times to some address (google free DNS here) and if no response try to get new IP address
:if ([/ping 8.8.8.8 interface=ethernet-gateway count=6] = 0) do={/ip dhcp-client release numbers=0}
@MayMeow
MayMeow / Examples.md
Last active February 13, 2022 03:07
Selfsigned Certificates for Code signing in visual studio

Create CA file

$c = New-SelfSignedCertificate -DnsName SelfSignedCA -CertStoreLocation Cert:\CurrentUser\My -NotAfter (Get-Date).AddYears(10)

check certificate fingerprint

$c
@MayMeow
MayMeow / .gitlab-ci.yml
Created April 15, 2022 08:09 — forked from htuscher/.gitlab-ci.yml
Deploying with docker-compose via SSH tunnel in Gitlab CI
deploy:live:
image: 1drop/docker:git
stage: deploy
when: manual
environment:
name: production
url: https://www.somecustomer.de
before_script:
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_PRIVATE_KEY")
@MayMeow
MayMeow / termina.json
Created June 28, 2022 11:26
terminal-theme.json
{
"background": "#2D2A2E",
"black": "#1A181A",
"blue": "#1080D0",
"brightBlack": "#707070",
"brightBlue": "#22D5FF",
"brightCyan": "#7ACCD7",
"brightGreen": "#A4CD7C",
"brightPurple": "#AB9DF2",
"brightRed": "#F882A5",
@MayMeow
MayMeow / run-script.ps1
Created October 27, 2022 13:45
Execute script over API on Mikrotik router
add-type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint, X509Certificate certificate,
WebRequest request, int certificateProblem) {
return true;
}
}