Skip to content

Instantly share code, notes, and snippets.

@code-boxx
code-boxx / 0-PHP-LIVE-CHAT.MD
Created May 31, 2023 05:44
PHP Live Chat

PHP LIVE CHAT

https://code-boxx.com/php-live-chat-websocket/

NOTES

  1. A copy of PHP Ratchet is not included. Use Composer to get the latest version - composer require cboden/ratchet.
  2. Run php 1-chat-server.php in the command line.
  3. Access 2a-chat-client.html in the web browser.

LICENSE

Copyright by Code Boxx

@CMCDragonkai
CMCDragonkai / database_typesystems.md
Last active May 16, 2024 08:29
Databases: Dependent Types in Databases

The database can make use of a more expressive type system. Specifically to enforce invariants on data integrity at the schema level. But also understanding databases from a type theoretic point of view can lead to better, safer and more expressive type systems.

You do not want to keep writing database validation code in your application boundary. That is tiring. Instead let your database do that work. After all, it is where the data is stored. It is where the data is migrated. So shouldn't it also maintain the integrity and the constraints of the data?

@atyuwen
atyuwen / opt_fsr.fxh
Last active May 16, 2024 08:28
An optimized AMD FSR implementation for Mobiles
//==============================================================================================================================
// An optimized AMD FSR's EASU implementation for Mobiles
// Based on https://github.com/GPUOpen-Effects/FidelityFX-FSR/blob/master/ffx-fsr/ffx_fsr1.h
// Details can be found: https://atyuwen.github.io/posts/optimizing-fsr/
// Distributed under the MIT License. Copyright (c) 2021 atyuwen.
// -- FsrEasuSampleH should be implemented by calling shader, like following:
// AH3 FsrEasuSampleH(AF2 p) { return MyTex.SampleLevel(LinearSampler, p, 0).xyz; }
//==============================================================================================================================
void FsrEasuL(
out AH3 pix,
@soatok
soatok / matrix.md
Last active May 16, 2024 08:28
Why I Don't Trust Matrix Developers to Produce a Secure Protocol

Ever since I wrote It's Time For Furries to Stop Using Telegram, I've had a few folks ask me about my opinion on Matrix.

(I've also had a few people evangelize Matrix in my mentions. That's annoying.)

My stance on Matrix has been the same for years: I don't trust the Matrix developers to produce a secure protocol, and until they abandon Olm / Megolm in favor of something like MLS, I'm adamant about refusing to trust their team's designs.

To understand why I feel so strongly about this, you need to understand that practically exploitable vulnerabilities were found in Matrix in 2022.

It isn't enough that there were vulnerabilities found to be alarming. Vulnerabilities happen. You aren't writing software if you don't occasionally fuck up.

@pyzlnar
pyzlnar / ecto_iex_helpers.ex
Last active May 16, 2024 08:28
A few Ecto helpers that you might want to add to your .iex.exs file. Were created with PSQL in mind
import_if_available(Ecto.Query)
# alias MyApp.Repo
defmodule R do
# Old habits die hard. Take a random of something. You don't care which.
# > R.take(SomeSchema)
def take(schema_or_query) do
schema_or_query
|> limit(1)
|> Repo.one()
@kyo-takano
kyo-takano / making-the-most-of-local-llms.ipynb
Last active May 16, 2024 08:26
ローカルLLMはこーやって使うの💢
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@maxrodrigo
maxrodrigo / git-split-and-push.sh
Last active May 16, 2024 08:26
Split a repository into batches to avoid `pack exceeds maximum allowed size` on push
# Split a repository into batches to avoid `pack exceeds maximum allowed size` on git push
REMOTE=origin
BRANCH=$(git rev-parse --abbrev-ref HEAD)
BATCH_SIZE=500
# check if the branch exists on the remote
if git show-ref --quiet --verify refs/remotes/$REMOTE/$BRANCH; then
# if so, only push the commits that are not on the remote already
range=$REMOTE/$BRANCH..HEAD
@arkadiusjonczek
arkadiusjonczek / gist:8836e724a53ddd55362644745cf8ca4c
Created December 31, 2016 01:30
Start Chrome in App Mode on Mac OS X
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --app="http://www.google.de"
@shamil
shamil / mount_qcow2.md
Last active May 16, 2024 08:22
How to mount a qcow2 disk image

How to mount a qcow2 disk image

This is a quick guide to mounting a qcow2 disk images on your host server. This is useful to reset passwords, edit files, or recover something without the virtual machine running.

Step 1 - Enable NBD on the Host

modprobe nbd max_part=8