Skip to content

Instantly share code, notes, and snippets.

View sagaban's full-sized avatar
🦆
Enjoying life

Santiago Bandiera sagaban

🦆
Enjoying life
View GitHub Profile
@Klerith
Klerith / vite-testing-config.md
Last active June 28, 2024 14:19
Vite + Jest + React Testing Library - Configuraciones a seguir

Instalación y configuracion de Jest + React Testing Library

En proyectos de React + Vite

  1. Instalaciones:
yarn add --dev jest babel-jest @babel/preset-env @babel/preset-react 
yarn add --dev @testing-library/react @types/jest jest-environment-jsdom
  1. Opcional: Si usamos Fetch API en el proyecto:
@tomhicks
tomhicks / useTaskQueue.ts
Created January 11, 2021 11:41
React Hook for queueing and processing async tasks sequentially
function useTaskQueue(params: {
shouldProcess: boolean
}): {
tasks: ReadonlyArray<Task>
isProcessing: boolean
addTask: (task: Task) => void
} {
const [queue, setQueue] = React.useState<{
isProcessing: boolean
tasks: Array<Task>
#!/bin/bash
sudo apt-get install -y devilspie
mkdir -p ~/.devilspie
echo '
(if (contains (window_class) "Code")
(begin
(spawn_async (str "xprop -id " (window_xid) " -f _KDE_NET_WM_BLUR_BEHIND_REGION 32c -set _KDE_NET_WM_BLUR_BEHIND_REGION 0 "))
(spawn_async (str "xprop -id " (window_xid) " -f _NET_WM_WINDOW_OPACITY 32c -set _NET_WM_WINDOW_OPACITY 0xD8000000"))
@ikbelkirasan
ikbelkirasan / change_window_opacity.sh
Last active June 16, 2023 18:04
Change window opacity in Linux using keyboard shortcuts
#!/bin/bash
function get_active_window() {
printf "0x%08x" $(xdotool getactivewindow)
}
function get_current_opacity() {
window="$1"
opacity=$(xprop -id $window | grep _NET_WM_WINDOW_OPACITY | awk '{print $3}')
if [ -z $opacity ]; then
#!/bin/bash
# Change to the script's directory & create directory
cd $(dirname "$(readlink -f "$0")")
mkdir -p ./dbdumps
# Load database name + root password
source .env
# Check if variables were provided
@bszwej
bszwej / echo.js
Last active June 26, 2024 17:54
Pure Node.js echo server, that logs all incoming http requests (method, path, headers, body).
const http = require('http');
const server = http.createServer();
server.on('request', (request, response) => {
let body = [];
request.on('data', (chunk) => {
body.push(chunk);
}).on('end', () => {
body = Buffer.concat(body).toString();
@embiem
embiem / Logger.js
Created May 5, 2017 12:14
Custom logging via ES6 class. Extendable.
class Logger {
constructor() {
if (!Logger.instance) {
Logger.instance = this;
}
return Logger.instance;
}
log(...args) {
console.log(...args);
@whizzzkid
whizzzkid / XPS-15 9560 Getting Nvidia To Work on KDE Neon
Last active December 3, 2022 15:43
[XPS 15 Early 2017 9560 kabylake] Making Nvidia Drivers + (CUDA 8 / CUDA 9 / CUDA 9.1) + Bumblebee work together on linux ( Ubuntu / KDE Neon / Linux Mint / debian )
# Instructions for 4.14 and cuda 9.1
# If upgrading from 4.13 and cuda 9.0
$ sudo apt-get purge --auto-remove libcud*
$ sudo apt-get purge --auto-remove cuda*
$ sudo apt-get purge --auto-remove nvidia*
# also remove the container directory direcotory at /usr/local/cuda-9.0/
# Important libs required with 4.14.x with Cuda 9.X
$ sudo apt install libelf1 libelf-dev
@alecthegeek
alecthegeek / gitcomenu.sh
Last active July 14, 2017 13:05
Make `git checkout <branch>` into a menu selection
OPS3=$PS3
echo There are multiple branchs in this repo. Please select the one you want to use
PS3='If you're not sure just choose "master" '
select br in $(git branch|sed -e '/^[* ] /s///'); do
[[ -n $br ]] && git checkout $br &&
break
done
PS3=$OPS3