Skip to content

Instantly share code, notes, and snippets.

View gifflet's full-sized avatar
🦅

Guilherme Sousa gifflet

🦅
View GitHub Profile
@gifflet
gifflet / first-vm-execution-and-snapshot-setup.MD
Last active January 10, 2024 16:07
QEMU VM with snapshot setup + samba file sharing

Requirements

  • telnet
  • qemu
  • samba

Command to install the requirements:

apt-get update && \
  apt-get install -y \
@gifflet
gifflet / old-release-ubuntu-sources.sh
Created October 2, 2023 15:43
Change sources repository file to old releases in Ubuntu
cp /etc/apt/sources.list /etc/apt/sources.list.bak
sudo sed -i -re 's/([a-z]{2}.)?archive.ubuntu.com|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list
sudo apt-get update
@gifflet
gifflet / git-executable-sh-file.sh
Last active January 27, 2023 14:52
Git - Add sh file as executable
git add <file>
git update-index --chmod=+x <file>
git commit -m 'adding execute permissions'
@gifflet
gifflet / generate-random-password.sh
Created November 16, 2022 03:21
Generate a random password
cat /dev/urandom | tr -dc A-Za-z0-9 | head -c 32 ; echo ' '
@gifflet
gifflet / move-docker-data.sh
Last active November 8, 2022 14:17
Change Docker default data folder location on Linux
#Stop docker service
sudo service docker stop
#Define the new folder to contain the all the docker data
sudo nano /etc/docker/daemon.json
{
"data-root": "/path/to/your/new/docker/root"
}
#Copy docker data folder to the same location indicated in data-root field in daemon.json
@mrclay
mrclay / flush-iptables.sh
Last active July 23, 2025 18:07
Flush IP tables and restart docker
#!/bin/bash
# Script is needed because my default firewall rules are messed up and after
# every restart, docker containers can't make connections to the host, notably
# preventing debuggers like xdebug from attaching.
# If networking fails in your containers but works in others, rm and re-create the
# docker network that container is bound to.
set -euo pipefail
@rgl
rgl / qemu-qmp.md
Last active February 18, 2025 22:56
qemu qmp

QEMU Machine Protocol (QMP) socket

Start QEMU with QMP UNIX socket and connect:

qemu-system-x86_64 -qmp unix:test.socket,server,nowait ...
nc -U test.socket
qmp-shell test.socket    # use the raw qmp interface. see https://github.com/0xef53/qmp-shell
qmp-shell -H test.socket # use the human interface.   see https://github.com/0xef53/qmp-shell
@beveradb
beveradb / selenium_curl_demo.sh
Created September 27, 2019 16:54
Demonstrate controlling Selenium directly via HTTP requests made with curl to a Selenium Grid Hub
# Set hostname and port of Selenium Grid Hub:
GRID_HOST="localhost"
GRID_PORT=4444
# Create new session, by specifying capabilities (in this case, just Chrome) to get a connection to a browser on a selenium node
# Store this session ID in a variable so we can use it for the other commands
SESSION_ID=`curl -X POST http://$GRID_HOST:$GRID_PORT/wd/hub/session -d '{"desiredCapabilities":{"browserName":"chrome"}}'| grep '"sessionId"' | sed 's/.*sessionId": "\(.*\)".*/\1/g'`
# Tell the browser to load the URL for LMGTFY
curl -X POST http://$GRID_HOST:$GRID_PORT/wd/hub/session/$SESSION_ID/url -d '{"url":"https://lmgtfy.com"}'
@qoomon
qoomon / conventional-commits-cheatsheet.md
Last active July 28, 2025 11:20
Conventional Commits Cheatsheet
#!/bin/bash
echo "removing evaluation key"
rm ~/.IntelliJIdea2017.3/config/eval/idea173.evaluation.key
echo "resetting evalsprt in options.xml"
sed -i '/evlsprt/d' ~/.IntelliJIdea2017.3/config/options/options.xml
echo "resetting evalsprt in prefs.xml"
sed -i '/evlsprt/d' ~/.java/.userPrefs/prefs.xml