Skip to content

Instantly share code, notes, and snippets.

View ggrandes's full-sized avatar
🛠️
I may be slow to respond.

G.Grandes ggrandes

🛠️
I may be slow to respond.
  • Spain
  • 03:43 (UTC +01:00)
View GitHub Profile
@ggrandes
ggrandes / randomMac-bash.sh
Last active October 12, 2024 16:59
Generate Random MAC-Address
#!/bin/bash
#
# Generate Random MAC-address
#
# Locally administered:
# X2-XX-XX-XX-XX-XX
# X6-XX-XX-XX-XX-XX
# XA-XX-XX-XX-XX-XX
# XE-XX-XX-XX-XX-XX
#
@ggrandes
ggrandes / HTMLDocumentEditor.java
Created May 7, 2022 07:37
Charles Bell's HTMLDocumentEditor
/* HTMLDocumentEditor.java
* @author: Charles Bell
* @version: May 27, 2002
*/
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import javax.swing.*;
@ggrandes
ggrandes / regex-ipv4.md
Created March 27, 2022 20:29
Regular Expression - IPv4 (Perl / Java)
Match: 0.0.0.0-255.255.255.255

Perl / PCRE

$input =~ /^(?:(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)\.){3}(?1)$/;
grep -P '^(?:(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)\.){3}(?1)$' <<<"$input"
@ggrandes
ggrandes / README.md
Last active November 2, 2019 18:36 — forked from alexandernst/ninja.py
Delete our Messages from Telegram

Instalacion y uso

Logueate en tu cuenta de Telegram desde https://my.telegram.org/

Ve a API Development toolsy de allí a Create new application, crea una con cualquier cosa, y modifica en el script API ID y API Hash

Dependencias

pip3 install telethon

@ggrandes
ggrandes / pocket_screen_cheatsheet.md
Last active September 27, 2022 08:44
Pocket Screen Cheatsheet

Screen Cheatsheet / Quick Reference (Pocket Friendly)

Escape Key

All screen commands are prefixed by an escape key, by default Ctrl-a (that's Control-a, sometimes written ^a). To send a literal Ctrl-a to the programs in screen, use Ctrl-a a. This is useful when when working with screen within screen. For example Ctrl-a a n will move screen to a new window on the screen within screen.

Description Command
Basic
Start a new session with session name screen -S
@ggrandes
ggrandes / tmux_vs_screen.md
Created February 6, 2019 10:35 — forked from P7h/tmux_vs_screen.md
tmux vs screen commands

tmux vs. screen commands


Action tmux screen
start a new session tmux
tmux new
tmux new-session
screen
start a new session with a name tmux new -s name screen -S name
re-attach a detached session tmux attach
tmux attach-session
screen -r
re-attach a detached session with a name tmux attach -t name
tmux a -t name
screen -r name
re-attach an attached session (detaching it from elsewhere) tmux attach -dtmux attach-session -d screen -dr
@ggrandes
ggrandes / mozlz4a.py
Created November 15, 2017 19:27 — forked from ylmrx/mozlz4a.py
MozLz4a compression/decompression utility
#!/usr/bin/env python3
#
# Decompressor/compressor for files in Mozilla's "mozLz4" format. Firefox uses this file format to
# compress e. g. bookmark backups (*.jsonlz4).
#
# This file format is in fact just plain LZ4 data with a custom header (magic number [8 bytes] and
# uncompressed file size [4 bytes, little endian]).
#
# This Python 3 script requires the LZ4 bindings for Python, see: https://pypi.python.org/pypi/lz4
#
@ggrandes
ggrandes / disable-web-push-notification-firefox.md
Last active October 7, 2017 12:33
How disable Web Push Notifications Globally in Firefox

To disable Web Push Notifications in Firefox, the following about:config must be set to false:

dom.webnotifications.enabled
dom.webnotifications.serviceworker.enabled
dom.push.connection.enabled
dom.push.enabled

Test Web Notifications:

@ggrandes
ggrandes / linux-settings.md
Created April 25, 2017 14:43
Linux Settings (sysfs / proc / kernel-param) [boot cmdline grub lilo]

I/O Scheduler (sysfs / kernel-param)

/sys/block/*/queue/scheduler
noop deadline cfq

elevator=deadline

IPv6 disable (proc / kernel-param)

sysctl -w net.ipv6.conf.all.disable_ipv6=1

ipv6.disable=1

Clock Source (sysfs/ kernel-param)

@ggrandes
ggrandes / backup.sh
Last active October 2, 2024 19:15
Simple Backup (LVM + rsync)
#!/bin/bash
# Original Source:
# https://gist.github.com/ggrandes/72c2c1f41d28664cff2d73a5ad5c5d05
#
# Sample Execution:
# nohup ./backup.sh vg1 root "--delete" 1>backup.log 2>&1 & tail -f backup.log
# Sample Params:
# vg1 root "--delete"
# vg1 kvm
LVM_VG="$1"