This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DELETE FROM mysql.global_priv WHERE User=''; | |
DELETE FROM mysql.global_priv WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1'); | |
DROP DATABASE IF EXISTS test; | |
DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%'; | |
FLUSH PRIVILEGES; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"cmp" | |
"context" | |
"fmt" | |
"slices" | |
"time" | |
_ "github.com/joho/godotenv/autoload" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"maps" | |
"slices" | |
"sort" | |
"github.com/godbus/dbus/v5" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -x | |
DBUS="gdbus call -y" | |
DEST=org.freedesktop.UDisks2 | |
OBJP=/org/freedesktop/UDisks2/block_devices/sdb | |
$DBUS -d $DEST -o $OBJP -m $DEST.Block.Format dos {} | |
$DBUS -d $DEST -o $OBJP -m $DEST.PartitionTable.CreatePartition 4194304 0 0x0e "" {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function s2b(data: string) { | |
return Uint8Array.from(data, c => c.charCodeAt(0)).buffer | |
} | |
function b2s(data: ArrayBufferLike) { | |
return String.fromCharCode(...new Uint8Array(data)) | |
} | |
function hex(data: ArrayBufferLike) { | |
return [...new Uint8Array(data)].map(x => x.toString(16).padStart(2, '0')).join('') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import type { FastifyInstance } from 'fastify' | |
import fp from 'fastify-plugin' | |
import type { ZodAny, ZodError, ZodTypeAny } from 'zod' | |
import { z } from 'zod' | |
import { fromZodError } from 'zod-validation-error' | |
declare module 'fastify' { | |
// TODO: Copy ZodTypeProvider here (output) | |
interface FastifyTypeProviderDefault { | |
output: this['input'] extends ZodTypeAny ? z.infer<this['input']> : unknown |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { extname } from 'node:path' | |
import sharp, { FormatEnum } from 'sharp' | |
import type { Plugin } from 'vite' | |
function sharpPlugin(): Plugin { | |
return { | |
name: 'vite:sharp', | |
enforce: 'post', | |
apply: 'build', | |
async generateBundle(_, bundle) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
args=( | |
minimal=yes # build only gpsd | |
gpsdclients=no # without clients | |
gpsd_group=uucp # arch linux group | |
socket_export=yes # fixes gps_unpack | |
control_socket=yes # for /run/gpsd.sock | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
An example that converts os.Args to argc/argv for C. | |
Can be used with any []string with the same procedure. | |
*/ | |
package main | |
/* | |
#include <stdio.h> | |
#include <stdlib.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/binary" | |
"fmt" | |
"net" | |
"time" | |
) | |
type Packet struct { |
NewerOlder