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
# For my kids and future setup | |
winget install Oracle.JavaRuntimeEnvironment | |
winget install Mojang.MinecraftLauncher | |
# If you want to build any mods in the future | |
# winget search java | |
winget install Oracle.JDK.23 |
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
<?php | |
declare(strict_types=1); | |
namespace App\Providers; | |
use Illuminate\Http\Client\Events\RequestSending; | |
use Illuminate\Http\Client\Events\ResponseReceived; | |
use Illuminate\Support\Facades\Event; |
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
<?php | |
public function writeQueryAsCsvFileToStorage() { | |
$disk = Storage::disk('yourDiskNameHer'); | |
// optional: ensure file doesn't exist: | |
// $disk->delete($filePath); | |
$cursor = $this->getQuery() | |
->toBase() // +-10x speed improvement, skip making laravel models | |
->cursor() // avoid loading whole result set into memory. | |
->map(fn ($item) => $this->map((array) $item)); |
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
protected function putfile(string $path, string $content) | |
{ | |
$host = config('services.sftp.host'); | |
$port = config('services.sftp.port'); | |
$con = ssh2_connect($host, $port, [], ['disconnect' => fn () => Log::debug('sftp disconeccted')]); | |
if (false === $con) { | |
throw new HttpException(503, 'sftp connection failed', ['sftpHost' => $host, 'sftpPort' => $port]); | |
} | |
if (false === ssh2_auth_password($con, config('services.sftp.username'), config('services.sftp.password'))) {\ | |
ssh2_disconnect($con); |
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 * as openpgp from "openpgp"; | |
import { writeFileSync } from "fs"; | |
import { join } from "path"; | |
var phrase = "test12"; | |
generateRsaKeys('test', phrase); | |
async function generateRsaKeys(name: string, passphrase: string) { | |
var options: openpgp.KeyOptions = { | |
userIds: [{ name: "Test user", email: "[email protected]" }], // multiple user IDs |
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
/** | |
* Crockford base32 encoding implementation (useable with random_bytes()) | |
* see: https://www.crockford.com/base32.html. | |
*/ | |
class CrockfordBase32 | |
{ | |
const BITS_5_RIGHT = 31; | |
const CHARS = '0123456789abcdefghjkmnpqrstvwxyz'; // lower-case |
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
<?php | |
namespace App\Providers; | |
use Illuminate\Support\Facades\Event; | |
class EventServiceProvider extends ServiceProvider | |
{ | |
/** |
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
// generic map function for the Map class for typescript | |
function MapMap<TKey, TValue, TReturn>(map: Map<TKey, TValue>, mapper: (key: TKey, value: TValue) => TReturn): TReturn[] { | |
var t = [] as TReturn[]; | |
map.forEach((val, key) => t.push(mapper(key, val))); | |
return t; | |
} | |
// USAGE EXAMPLE | |
interface SimpleSelectProps extends BaseFieldProps<string> { |
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
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"name": "Run ts-mocha File", | |
"type": "node", | |
"request": "launch", | |
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/ts-mocha", | |
"runtimeArgs": [ | |
"${file}" |
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
require('ts-mocha'); | |
const Mocha = require('mocha'); | |
const fs = require('fs'); | |
let testSubject = null; | |
if (process.argv.length === 3) { | |
testSubject = process.argv[2]; | |
} | |
const mocha = new Mocha({ timeout: 50000 }); |
NewerOlder