Skip to content

Instantly share code, notes, and snippets.

View luckyshot's full-sized avatar
🌍
xaviesteve.com

Xavi Esteve luckyshot

🌍
xaviesteve.com
View GitHub Profile
@luckyshot
luckyshot / README.md
Last active October 3, 2024 07:02 — forked from pgillet/README.md
Switch audio output devices on Linux

Audio Output Switcher

This script will cycle to the next available audio output device. It can be tied to a hotkey to easily be triggered. This is handy, for example, for swapping between HDMI audio and headphones.

Install

  1. Download the audio-device-switch.sh script and place it in /usr/local/bin.
  2. Make the script executable: sudo chmod 755 /usr/local/bin/audio-device-switch.sh.
  3. Open the Keyboard Shortcuts settings page, add a new shortcut, tell it to execute audio-device-switch.sh, and set up your shortcut!
  4. Install the notify-send library if you want to see a popup notification when the audio device switches: sudo apt install libnotify-bin.

Customizations

@luckyshot
luckyshot / CleanUpGmail.gs
Last active May 18, 2024 07:17 — forked from alimbada/CleanUpGmail.gs
Google Apps Script for cleaning up Gmail
/**
* Scripts: https://script.google.com/u/0/home/my
* Triggers: https://script.google.com/u/0/home/triggers
*/
function cleanUpGmail() {
var queries = [
'from:([email protected]) in:inbox subject:(from your Steam wishlist on sale) older_than:7d',
'from:([email protected]) in:inbox subject:(is live) older_than:1d',
'from:ebay.com subject:("is live!" OR "has been relisted") older_than:7d',
// Security alerts
@luckyshot
luckyshot / default.yml
Last active October 31, 2023 16:51
Xavi Esteve's Espanso config file (Linux: ~/.config/espanso/match/base.yml // Mac: ~/Library/Preferences/espanso/default.yml)
# espanso match file
# For a complete introduction, visit the official docs at: https://espanso.org/docs/
# You can use this file to define the base matches (aka snippets)
# that will be available in every application when using espanso.
# Matches are substitution rules: when you type the "trigger" string
# it gets replaced by the "replace" string.
matches:
@luckyshot
luckyshot / colors.scss
Created March 2, 2021 23:50
Dieter Rams (Braun) - CSS/SCSS Color Palette
/**
* Colours taken from Dieter Rams legendary production collection for Braun. Made by Chad Ashley.
* Source: http://blog.presentandcorrect.com/rams-palettes
* Demo: https://xaviesteve.com/pro/colorpalettes/
* Try it: https://xaviesteve.com/pro/sass-palette/
* Compiled by Xavi Esteve
*/
// DR06
@luckyshot
luckyshot / bookmarklets.md
Created February 26, 2021 19:03
Bookmarklets: Useful miscelaneous

CaixaBank

Get total fluctuation to paste in Excel:

let total = '';
document.querySelectorAll('.color--gray500.font--size-90.white_space--nowrap').forEach(function(item){total += "\n" + item.innerHTML.replace('+ ', '').replace('.','').replace(',','.');});
console.log(total)
@luckyshot
luckyshot / hacker-news.css
Last active December 18, 2022 18:10
Hacker News Dark Theme Mode CSS code
/**
* HackerNews better readability
* Use any Browser extension that lets you add CSS code.
* © XaviEsteve.com
* https://gist.github.com/luckyshot/af6687f8ac3b0dc458818753dccbd412/
* Last updated: 18 Dec 22
*/
/* Home */
html, body {
@luckyshot
luckyshot / example.css
Last active January 15, 2021 09:43
TailWindCSS Color Palette as CSS native variables
html {
--colorIndigo50: #EEF2FF;
color: var(--colorIndigo50);
}
@luckyshot
luckyshot / download.js
Created September 18, 2020 13:28
Download all images from website (JS + PHP)
var buffer = [];
document.querySelectorAll('img').forEach(function(item) {
if (item.src){
buffer.push( item.src );
}
});
console.log('Total items:', buffer.length );
localStorage.buffer = JSON.stringify(buffer);
// Now grab localStorage.buffer and paste it in PHP
@luckyshot
luckyshot / flexbox.css
Created September 14, 2020 08:34
Tiny Minimal Flexbox Grid
.flex-grid {
display: flex;
}
.col {
flex: 1;
}
/* Break on mobile? */
@media (max-width: 400px) {
.flex-grid {
@luckyshot
luckyshot / distance.php
Created September 9, 2020 09:56
PHP distance between two points (flat coordinates 2 XY axis)
<?php
function distance($x1, $y1, $x2, $y2){
return sqrt(
pow(abs($x1 - $x2), 2)
+
pow(abs($y1 - $y2), 2)
);
}