Skip to content

Instantly share code, notes, and snippets.

@cawa0505
cawa0505 / hx-astro-view-transition.js
Created October 1, 2023 06:34 — forked from AceCodePt/hx-astro-view-transition.js
htmx-astro-view-transition
htmx.defineExtension("hx-astro-view-transition", {
onEvent: function (name, evt: any) {
if (name === "htmx:afterRequest") {
const attributes = evt.target.attributes;
const viewTransitionTarget =
attributes["hx-view-transition"]?.value;
if (!viewTransitionTarget) {
console.log(evt);
return;
}
@cawa0505
cawa0505 / nvmrc
Created September 30, 2023 21:54 — forked from xiaolai/nvmrc
bash function for load .nvmrc automatically
# for nvm
export NVM_DIR="$HOME/.nvm"
. "$(brew --prefix nvm)/nvm.sh"
load-nvmrc() {
if [[ -f .nvmrc && -r .nvmrc ]]; then
nvm use
elif [[ $(nvm version) != $(nvm version default) ]]; then
echo "Reverting to nvm default version"
nvm use default
@cawa0505
cawa0505 / download_from_minio.sh
Created September 24, 2023 20:46 — forked from JustinTimperio/download_from_minio.sh
Download a File to Minio with Curl and Zero External Libraries or Programs
#!/usr/bin/env sh
# Example: ./download_minio.sh example.url.com username password bucket-name minio/path/to/file.txt.zst /download/path/to/file.txt.zst
if [ -z $1 ]; then
echo "You have NOT specified a MINIO URL!"
exit 1
fi
if [ -z $2 ]; then
@cawa0505
cawa0505 / AwsCognitoIdentitySRP.php
Created August 15, 2023 18:46 — forked from jenky/AwsCognitoIdentitySRP.php
AWS Cognito Identity SRP authentication helper
<?php
use Aws\AwsClient;
use Aws\Result;
use Carbon\Carbon;
use phpseclib3\Math\BigInteger;
class AwsCognitoIdentitySRP
{
const N_HEX = 'FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1'.
<?php
$response = LoginShopee('username','password');
echo $response;
function LoginShopee($SP_Username,$SP_Pass) {
//Khởi tạo chung cho toàn bộ request bên dưới
$ch=curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
@cawa0505
cawa0505 / Envoy.blade.php
Created June 5, 2023 05:01 — forked from mabasic/Envoy.blade.php
Envoy common features with Slack notifications. See http://laravel.com/docs/5.0/envoy for more info.
@servers(['web' => 'username@domain.com -p 1234'])
@setup
$project_name = 'Project Name';
$project_url = 'http://project-domain.com/';
$project_root = '/www/project/web';
$slack_hook = 'your-slack-hook-url';
$slack_channel = '#channel';
@endsetup
# example using the VM from https://practicalbinaryanalysis.com/
# Get some handy virt-manager and virtsh tools
$ sudo apt install virt-manager
# Make sure the libvirtd service is running
$ systemctl status libvirtd.service | head -13
● libvirtd.service - Virtualization daemon
Loaded: loaded (/lib/systemd/system/libvirtd.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2019-03-26 13:55:54 EDT; 27min ago
@cawa0505
cawa0505 / README.md
Created May 23, 2023 15:30 — forked from pojntfx/README.md
Enable prefers-color-scheme support, GTK4, Wayland and hardware acceleration for Chrome on Linux

Paste the following into your terminal; this will enable prefers-color-scheme support for Chrome on Linux. You'll have to fully close the browser with pkill chrome each time you want Chrome to re-read the settings, i.e. when you want it to toggle from light to dark or the other way around.

Also, use the following flags for full GPU acceleration:

  • ignore-gpu-blocklist
  • enable-webrtc-pipewire-capturer
  • enable-gpu-rasterization
  • enable-vulkan
  • enable-zero-copy
  • enable-raw-draw
@cawa0505
cawa0505 / create-cloud-template.sh
Created May 21, 2023 11:10 — forked from chriswayg/create-cloud-template.sh
This script will download a cloud image of many Linux distros and create a Proxmox 6 KVM template from it.
#!/bin/bash
set -o errexit
clear
printf "\n*** This script will download a cloud image and create a Proxmox VM template from it. ***\n\n"
### HOW TO USE
### Pre-req:
### - run on a Proxmox 6 server
### - a dhcp server should be active on vmbr1
@cawa0505
cawa0505 / kitty.conf
Created May 6, 2023 11:10 — forked from despreston/kitty.conf
Kitty conf
# vim:fileencoding=utf-8:ft=conf:foldmethod=marker
#: Fonts {{{
#: kitty has very powerful font management. You can configure
#: individual font faces and even specify special fonts for particular
#: characters.
font_family Menlo Regular
bold_font Menlo Bold