Skip to content

Instantly share code, notes, and snippets.

@thibaut-decherit
thibaut-decherit / symfony-logout-csrf-protection.md
Last active May 11, 2024 10:15
Symfony - Logout with CSRF protection

URL version (GET)

config/packages/security.yaml

security:
  firewalls:
    main:
      logout:
        path: logout
        csrf_parameter: token
 csrf_token_generator: security.csrf.token_manager
@thibaut-decherit
thibaut-decherit / form-button.md
Last active May 11, 2024 10:15
Symfony Form Button

Form Button

Useful to send data to the server without relying on the user clicking on a link, which would send a GET request, which should not be used for destructive operations (operations with database writing).

For reference, see https://softwareengineering.stackexchange.com/questions/188860/why-shouldnt-a-get-request-change-data-on-the-server and https://stackoverflow.com/questions/46585/when-do-you-use-post-and-when-do-you-use-get

You could use it for a like button, a confirm button, a delete button...

Button with data passed

You need to activate an account. You send a link containing an activation token to the user. You could stop there and just activate the account once a GET request is sent to this url.

@earthdiver
earthdiver / taskbar.ps1
Last active May 11, 2024 10:15
A code snippet to put a resident PowerShell script into the taskbar notification area
#@Powershell -NoP -W Hidden -C "$PSCP='%~f0';$PSSR='%~dp0'.TrimEnd('\');&([ScriptBlock]::Create((gc '%~f0'|?{$_.ReadCount -gt 1}|Out-String)))" %* & exit/b
# by earthdiver1 V1.05
if ($PSCommandPath) {
$PSCP = $PSCommandPath
$PSSR = $PSScriptRoot
$code = '[DllImport("user32.dll")]public static extern bool ShowWindowAsync(IntPtr hWnd,int nCmdShow);'
$type = Add-Type -MemberDefinition $code -Name Win32ShowWindowAsync -PassThru
[void]$type::ShowWindowAsync((Get-Process -PID $PID).MainWindowHandle,0)
}
Add-Type -AssemblyName System.Windows.Forms, System.Drawing
@GentlemanRevvnar
GentlemanRevvnar / 1.19-custom_structures_with_jigsaws.md
Last active May 11, 2024 10:11
Simple guide for using jigsaws in custom structures in 1.19

Custom data pack structures with jigsaws in 1.19

(Last updated: 1.19)

This is a direct conversion for 1.19, of my original guide for 1.18.2.
For the sake of continuity i will show everything from groundup again. I would show the new 1.19 sections in different colour, but github doesn't allow that 😐

This is technically a shameless rip/edit of Misode's guide (go give that beautiful man a heart under his guides) that shows the traditional use of newly implemented custom structure system. I myself want to tackle the jigsaw aspect a bit, hence i'm making my own guice based on his. I will show how to create a data pack that adds custom structures to the world that also utilize jigsaw blocks. So treat this as a basic jigsaw guide in world generation. There is a download for the datapack at the end of this guide.

**Always leave the world and rejoin to apply the new changes! Because traditional /reload or `/datapack disable & enabl

@FreddieOliveira
FreddieOliveira / docker.md
Last active May 11, 2024 10:10
This tutorial shows how to run docker natively on Android, without VMs and chroot.

Docker on Android πŸ‹πŸ“±

Edit πŸŽ‰

All packages, except for Tini have been added to termux-root. To install them, simply pkg install root-repo && pkg install docker. This will install the whole docker suite, left only Tini to be compiled manually.


Summary

@Meshiest
Meshiest / godot multiplayer.md
Last active May 11, 2024 10:08
overview of how I understand godot multiplayer

Godot 4 Scene Multiplayer

I'm too lazy to write this as official documentation so I'm transcribing my experiences here for reference.

This is high level and does not cover how to setup your peer, only how to use the API itself.

This is not a tutorial.

If you are just getting started, this tutorial by DevLogLogan is worth watching.

@oanhnn
oanhnn / using-multiple-github-accounts-with-ssh-keys.md
Last active May 11, 2024 10:07
Using multiple github accounts with ssh keys

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
@lodi-g
lodi-g / HOWTO.md
Created March 14, 2021 14:19
How to setup a send-only mail server with TLS and SMTP credentials (postfix, submission, CyrusSASL)

Prepare server

  • sudo hostnamectl set-hostname example.com
  • sudo apt install mailutils postfix
    • Choose "internet site", and type your domain (example.com)

Test postfix

  • mail your-test@yopmail.com -s "Subject"
  • You should receive a mail from debian@example.com
@NatureGeorge
NatureGeorge / rp.ipynb
Last active May 11, 2024 10:06
Jupyter Notebook Demo for calculating phi-psi info of a PDB file via Biopython
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ahx
ahx / openapi_first-committee-comparison.md
Last active May 11, 2024 10:06
Comparing openapi_first and committee

This is a feature comparison of openapi_first and committee

I will try to keep this updated. Please create an issue if you see something wrong/missing here.

JSON Schema validation

Most of these differences are because openapi_first uses json_schemer, which has build in support for OpenAPI 3.1 where committee/openapi_parser currently ships it's own implementation.

Feature openapi_first committee