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
#!/bin/bash
#set -x
# Shows you the largest objects in your repo's pack file.
# Written for osx.
#
# @see https://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/
# @author Antony Stubbs
# set the internal field separator to line break, so that we can iterate easily over the verify-pack output
@scmanjarrez
scmanjarrez / gist:53d43d5aee335a809a9fc1eb81c39f00
Created May 17, 2022 09:57 — forked from zakkak/gist:ab08672ff9d137bbc0b2d0792a73b7d2
Resizing a filesystem using qemu-img and fdisk

Occasionally we will deploy a virtual instance into our KVM infrastructure and realize after the fact that we need more local disk space available. This is the process we use to expand the disk image. This process assumes the following:

  • You're using legacy disk partitions. The process for LVM is similar and I will describe that in another post.
  • The partition you need to resize is the last partition on the disk.

This process will work with either a qcow2 or raw disk image. For

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 / 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.