Skip to content

Instantly share code, notes, and snippets.

View scmanjarrez's full-sized avatar
🧠
hungry mind

Sergio C scmanjarrez

🧠
hungry mind
  • Spanish National Research Council (CSIC)
  • Madrid
View GitHub Profile
import QtQuick 2.12
Rectangle {
property var toFill: parent // instantiation site "can" (optionally) override
property color customColor: 'yellow' // instantiation site "can" (optionally) override
property int customThickness: 1 // instantiation site "can" (optionally) override
anchors.fill: toFill
z: 200
color: 'transparent'
@scmanjarrez
scmanjarrez / extradistance.css
Created October 1, 2022 22:51
fix button sizes octoprint extra distance button plugin
distance-selector {
width: 176px;
}
#jog_distance1, #jog_distance2, #jog_distance3 {
width: 176px;
padding-left: 0px;
padding-bottom: 0px;
margin-left: 0px;
margin-bottom: 0px;
}
@scmanjarrez
scmanjarrez / docker-compose.yaml
Created October 24, 2022 13:58
Esports Capsule Farmer docker compose changes to be used in x86_64: https://github.com/kacperkr90/EsportsCapsuleFarmer
services:
firefox:
restart: always
image: selenium/standalone-firefox:104.0
container_name: selenium_firefox
shm_size: 2g
mem_limit: 512m
mem_reservation: 256m
cpus: 1
ports:
@scmanjarrez
scmanjarrez / klippy@extras@gcode_move.py
Last active February 8, 2023 20:15
Code snippet for custom gcodes in klipper to start Tuya Smart Plugs using tinytuya without printer connection
gcode.register_command('TUYA_ON', self.cmd_TUYA_ON, True,
desc=self.cmd_TUYA_ON_help)
gcode.register_command('TUYA_OFF', self.cmd_TUYA_OFF, True,
desc=self.cmd_TUYA_OFF_help)
### ...
### ...
cmd_TUYA_ON_help = "Turn on Tuya Smart Plug"
def cmd_TUYA_ON(self, gcmd):
try:
proc = subprocess.Popen(
@scmanjarrez
scmanjarrez / resin.py
Last active December 2, 2023 02:01
genshin resin api
import hashlib
import time
import random
import string
import requests as req
salt = "6cqshh5dhw73bzxn20oexa9k516chk7s" # borrowed from https://github.com/thesadru/genshinstats
uid = 12345678 # int
ltoken = "verylargestringtokenxxxxxxxxxxxxxxxxxxx" # str
ltuid = "87654321" # str
@scmanjarrez
scmanjarrez / overleaf_smtp_gmail_community_edition.md
Last active December 6, 2023 19:16
Enable Gmail SMTP on Overleaf Community Edition (CE)

I'll leave my workaround to use with gmail for future reference after testing every suggestion here without success:

  • Define SMTP_USER and SMTP_PASS
       SHARELATEX_EMAIL_SMTP_USER=your_email
       SHARELATEX_EMAIL_SMTP_PASS=app_password # requires 2fa enabled
    
  • Connect to sharelatex container (docker exec) and run this command:
    $ cp /overleaf/services/web/app/src/Features/Email/EmailSender.js /var/lib/sharelatex
@scmanjarrez
scmanjarrez / overleaf_server_enable_register_community_edition.md
Last active December 6, 2023 20:03
Enable register on Overleaf Server Community Edition (CE)

I'll leave my workaround to enable register for future reference:

  • Start the containers as always

    I'm assuming you're using overleaf toolkit

  • Connect to sharelatex container, we need to copy the following files to /var/lib/sharelatex so we can edit them in the host and bind the new version.
    $ cp app/views/user/register.pug /var/lib/sharelatex
    $ app/src/router.js /var/lib/sharelatex
    $ app/src/Features/User/UserController.js /var/lib/sharelatex
    $ app/src/Features/User/UserPagesController.js /var/lib/sharelatex
@scmanjarrez
scmanjarrez / tp-link-ac600-ac1300-drivers-linux.md
Created January 18, 2024 18:41 — forked from julianlam/tp-link-ac600-ac1300-drivers-linux.md
Installing drivers for the TP-Link T2U/T3U Plus (AC600 or AC1300) Wireless Adapter #blog
@scmanjarrez
scmanjarrez / rename.md
Last active January 19, 2024 15:57
wifi rename netplan

During an experiment, I need to use three WiFi interfaces on a Raspberry Pi running Ubuntu 20.04. In addition to Raspberry Pi's internal WiFi interface, I added two USB WiFi adapters. Three network interfaces showed up in the system (ip link command), and they are named wlan0, wlan1, and wlan2 by default.

I often need to capture packets with tcpdump, and I often have to be type these interface names manually. It isn't easy to remember the purpose of each network interface, so I wanted to rename the interfaces to reflect their role in my application. However, this isn't as easy as it sounds.

🚫 Netplan

Ubuntu 20.04 configures network interfaces using Netplan, so my first thought was: I can write a Netplan configuration that matches network interfaces with their MAC addresses, and assigns the desired name to each network interface.

@scmanjarrez
scmanjarrez / install.sh
Created January 25, 2024 10:19
Install microsoft propietary fonts in linux (calibri, cambria, corbel, etc)
#!/bin/bash
TMPDIR=/tmp/msfonts
mkdir -p $TMPDIR
cd $TMPDIR
wget https://sourceforge.net/projects/mscorefonts2/files/cabs/PowerPointViewer.exe
cabextract -L -F ppviewer.cab -d . PowerPointViewer.exe
cabextract -L -F '*.TT[FC]' -d . ppviewer.cab