Skip to content

Instantly share code, notes, and snippets.

View UnJavaScripter's full-sized avatar

Diego Coy UnJavaScripter

View GitHub Profile
@UnJavaScripter
UnJavaScripter / dslr-webcam-selector.sh
Created February 18, 2023 21:27
A bash script that allows the user to pick a gphoto2 compatible camera connected to their linux device to create a virtual webcam using v4l2loopback
#!/bin/bash
##
# Error "An error occurred in the io-library ('Timeout reading from or writing to the port'): No error description available ERROR: Movie capture error... Exiting."
# -> https://github.com/gphoto/gphoto2/issues/495
##
generate_virtual_camera_names() {
local length=$1
@UnJavaScripter
UnJavaScripter / sound-box
Last active December 7, 2022 18:38
A method to combine an input device and a virtual device's signals into a single virtual input device using pipewire & pactl
# Based on the response from user Pujianto over https://superuser.com/questions/1675877/how-to-create-a-new-pipewire-virtual-device-that-to-combines-an-real-input-and-o
# Create combined sink
pactl load-module module-null-sink media.class=Audio/Sink sink_name=my-combined-sink channel_map=stereo
# Link audio source (mic) to combined sink
## Get the mic device name with: `pw-link -o`
pw-link $NAME_OF_THE_INPUT_DEVICE my-combined-sink:playback_FL
pw-link $NAME_OF_THE_INPUT_DEVICE my-combined-sink:playback_FR
@UnJavaScripter
UnJavaScripter / config.txt
Last active September 18, 2022 23:08
Tweaks to make things look better on a raspberry pi official touchscreen
# /boot/config.txt
#####
# Commenting out `dtoverlay=vc4-fkms-v3d` as disabling GPU acceleration is required in order to be able to rotate the lcd.
# More memory is assigned to the GPU by setting a new value to `gpu_mem`
# `lcd_rotate=2` Rotates the display by 180°
#####
# ...
@UnJavaScripter
UnJavaScripter / keybindings.json
Last active December 9, 2022 23:03
VSCode keyboard shortcuts to make MacOS's keyboard a little bit less awful
[
// Redo
{ "key": "ctrl+y", "command": "redo",
"when": "editorFocus" },
// Delete current line
{ "key": "shift+delete", "command": "editor.action.deleteLines",
"when": "editorFocus" },
// Move current line up
{ "key": "ctrl+shift+up", "command": "editor.action.moveLinesUpAction",
"when": "editorFocus" },
@UnJavaScripter
UnJavaScripter / basic_sw.js
Created October 2, 2017 17:38
A demo service worker file
const CACHE_ACTUAL = 'cache';
const archivos_para_cachear = [
'/',
'/?launcher=true',
'/main.js',
'/styles.css',
'/assets/logo.png'
];
// Instalación del service worker y cacheo inicial
self.addEventListener('install', (event) => {
@UnJavaScripter
UnJavaScripter / brute_pi.sh
Last active November 16, 2016 02:01
SSH into your Raspberry Pi using brute force... Doesn't hax or anything, just attempts to connect to all the IP addresses in a range
#!/bin/bash
user_name="${1:-pi}"
ip_range="${2:-192.168.1}"
ip_from="${3:-1}"
ip_to="${4:-99}"
echo -e "Attempting to connect to a pi with user name: ${user_name}\n"
for i in $(seq ${ip_from} ${ip_to})
@UnJavaScripter
UnJavaScripter / keybindings.json
Last active June 14, 2020 12:24
VS Code keyboard shortcuts
[
// Move current line up
{ "key": "ctrl+shift+up", "command": "editor.action.moveLinesUpAction",
"when": "editorFocus" },
// Move current line down
{ "key": "ctrl+shift+down", "command": "editor.action.moveLinesDownAction",
"when": "editorFocus" },
// Create new cursor above
{ "key": "alt+up", "command": "editor.action.insertCursorAbove",
"when": "editorTextFocus" },
@UnJavaScripter
UnJavaScripter / tostada.js
Created July 27, 2016 00:13
A sample toaster library - Una librería para 'toasts' de ejemplo
"use strict";
class Tostada {
constructor(config) {
// Exponemos config como una variable 'global' dentro de la clase
this.config = config;
let estilos = document.createElement('style');
estilos.innerHTML = `
@UnJavaScripter
UnJavaScripter / vscode_angular-snippets.js
Created June 27, 2016 18:38
Visual Studio Code AngularJS Snippets
{
// Place your snippets for JavaScript here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, ${id} and ${id:label} and ${1:label} for variables. Variables with the same id are connected.
// Example:
"Console log": {
"prefix": "c",
"body": [
"console.log($1);"
@UnJavaScripter
UnJavaScripter / install_stuff.sh
Last active March 4, 2016 15:14
install_stuff
#!/bin/sh
THEM_APPS="google-chrome-stable \
git-core \
tig \
curl"
THEM_MODULES="yo \
gulp \
bower \
live-server \