Skip to content

Instantly share code, notes, and snippets.

@wijourdil
wijourdil / test_mail.php
Last active May 1, 2024 08:25
Send a test mail / notification in Laravel from Tinker
<?php
/**
* Mail
*/
Mail::raw('hello world', function($message) { $message->to('myawesomeemail@domain.com')->subject('Testing mails'); });
/**
* Notification
*/
@awwx
awwx / transmute.md
Last active May 1, 2024 08:25
transmute

Here's a mechanism for transforming a discrete input flow into an output flow where the internal process state can be implemented with loop/recur. As an example I provide an implementation of "batching with both a maximum size and a maximum delay" referenced in leonoel/missionary#109.

Transforming discrete flows

A common pattern for discrete flows is that we want to create an output flow from an input flow, where:

/* usbreset -- send a USB port reset to a USB device
*
* Compile using: gcc -o usbreset usbreset.c
*
*
* */
@aymericbeaumet
aymericbeaumet / delete-likes-from-twitter.md
Last active May 1, 2024 08:23
[Recipe] Delete all your likes/favorites from Twitter

Ever wanted to delete all your likes/favorites from Twitter but only found broken/expensive tools? You are in the right place.

  1. Go to: https://twitter.com/{username}/likes
  2. Open the console and run the following JavaScript code:
setInterval(() => {
  for (const d of document.querySelectorAll('div[data-testid="unlike"]')) {
    d.click()
 }
@paulswail
paulswail / api-client.ts
Last active May 1, 2024 08:18
AppSync GraphQL CodeGenerator Config with Lambda resolver types, Nodejs operation functions and React hooks
// frontend lib module which is injected into the codegen'd hooks
import { getAuthToken } from './auth'
export const API_URL = process.env.REACT_APP_API_URL!
/**
* Custom fetcher used by codegen'd hooks to first load auth token, then make the fetch request.
*/
export const fetcher = <TData, TVariables>(query: string, variables?: TVariables) => {
return async (): Promise<TData> => {
@themeteorchef
themeteorchef / Javascript ISO country code to country name conversion
Created October 5, 2015 20:16 — forked from maephisto/Javascript ISO country code to country name conversion
ISO 3166-1 alpha-2 country code to country name conversion with a simple Javascript implementation, an array and a function.
var isoCountries = {
'AF' : 'Afghanistan',
'AX' : 'Aland Islands',
'AL' : 'Albania',
'DZ' : 'Algeria',
'AS' : 'American Samoa',
'AD' : 'Andorra',
'AO' : 'Angola',
'AI' : 'Anguilla',
'AQ' : 'Antarctica',
@scyto
scyto / proxmox-backup.md
Last active May 1, 2024 08:05
setup promox backup server and synology as data store over SMB

Proxmox Backup

At this time proxmox backup only backs up VM and Containers - ths guide covers that.

What i didn't realize is the backup job is still defined on the cluster and PBS provides a new storage type that dedupes and managed all the vzdump files created - which is cool.

I decided to run proxmox backup on my Synology NAS where it has more reliable connection to the NAS (i.e. via memory) for doing deduple, garbage collection, prune, verification etc. However the steps here generally remain true.

Once again i used one of Derek Seaman's Awesome Blogs for the basis of this - but with my own tweaks (like using SMB instead of CIFS. As of 9/21 my tweaks are signifcnant, in the original blog it is missing steps to enable encoding acceleration in CTs and VMs.

this gist is part of this series

#!/usr/bin/env bash
# Abort sign off on any error
set -e
# Start the benchmark timer
SECONDS=0
# Repository introspection
OWNER=$(gh repo view --json owner --jq .owner.login)
@hitthemoney
hitthemoney / Krunker WebSockets Explained.md
Last active May 1, 2024 08:03
This markdown file explains Krunker.io's social websockets and how to connect, get data from them, captchas, and more.

Krunker WebSockets Explained

WebSocket

WebSocket is a protocol over http. You should read: https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API for more info on WebSocket.

Encoding/Decoding

Krunker uses msgpack for decoding and encoding packets. Msgpack is also smaller and sometimes faster depending on the implementation you use/make.

Packets

Like I said earlier, Krunker uses msgpack for decoding and encoding packets. A ping packet would like this: ["po"] which you send when you get a ["pi"] packet, and the ping result packet you receive is ["pir", ]. For fetching a profile, you can use ["r", "profile", , null]. The result packet would be like ["0", "profile", , , , , ...etc]. For finding packets, you can download https://krunker.io/social.html using a command like cURL, formatting the file and lo