Skip to content

Instantly share code, notes, and snippets.

View jamesfreeman959's full-sized avatar

James Freeman jamesfreeman959

  • London, England
View GitHub Profile
@wneessen
wneessen / setMacDNS.sh
Created January 24, 2011 14:00
Set your MacOS X resolver using scutil for all interfaces
INTERFACES=`echo "list State:/Network/Service/[^/]+/DNS" | scutil | awk -F= '{print $2}'`
SERVER=<yourDNS>
for INTERFACE in ${INTERFACES}
do
echo "get ${INTERFACE}\nd.add ServerAddresses * ${SERVER}\nset ${INTERFACE}" | sudo scutil
done
@wadey
wadey / iterm2.zsh
Last active March 10, 2024 00:32
Change iTerm2 tab color when using SSH
# Usage:
# source iterm2.zsh
# iTerm2 tab color commands
# https://iterm2.com/documentation-escape-codes.html
if [[ -n "$ITERM_SESSION_ID" ]]; then
tab-color() {
echo -ne "\033]6;1;bg;red;brightness;$1\a"
echo -ne "\033]6;1;bg;green;brightness;$2\a"

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@kevin-smets
kevin-smets / iterm2-solarized.md
Last active June 21, 2024 14:48
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@kmpm
kmpm / README.md
Last active June 4, 2019 17:31
smstools with usb dongle on rpi

How to install smstools on Raspberry PI with a nn dongle

Get deviceid for the dongle

sudo lsusb

I get the result...

@shamil
shamil / mount_qcow2.md
Last active June 17, 2024 17:27
How to mount a qcow2 disk image

How to mount a qcow2 disk image

This is a quick guide to mounting a qcow2 disk images on your host server. This is useful to reset passwords, edit files, or recover something without the virtual machine running.

Step 1 - Enable NBD on the Host

modprobe nbd max_part=8
@pierew
pierew / avahi-discovery.sh
Last active May 11, 2024 10:58
A Little script that to the Avahi Discovery and put into /etc/hosts. Because my Avahi don't works well
#!/bin/bash
# Required Stuff
# * sed
# * grep
# * egrep
# * avahi-browse
# * cut
# * sort
# * awk
#
@cabal95
cabal95 / vm-backup.sh
Created July 25, 2015 17:53
I use this script to backup my QEMU/KVM/libVirt virtual machines. The script requires KVM 2.1+ since it uses the live blockcommit mode. This means the data in the snapshot disk is rolled back into the original instead of the other way around. Script does NOT handle spaces in paths.
#!/bin/bash
#
BACKUPDEST="$1"
DOMAIN="$2"
MAXBACKUPS="$3"
if [ -z "$BACKUPDEST" -o -z "$DOMAIN" ]; then
echo "Usage: ./vm-backup <backup-folder> <domain> [max-backups]"
exit 1
@joseluisq
joseluisq / disable_git_gnome_ssh_askpass.md
Last active April 1, 2024 15:27
Disable Git gnome-ssh-askpass on RedHat related OS (Fedora, CentOS)

Disable Git gnome-ssh-askpass on RedHat related OS (Fedora, CentOS)

1.- Add these lines to ~/·bashrc or ~/.zshrc file :

[ -n "$SSH_CONNECTION" ] && unset SSH_ASKPASS
export GIT_ASKPASS=

2.- Update source files:

@joecampo
joecampo / install_pdo_sqlsrv.sh
Last active May 25, 2023 00:14
Install Official MSSQL driver for Unbuntu 14.04 - pdo_sqlsrv
#!/bin/bash
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo -i export CPPFLAGS="-DSIZEOF_LONG_INT=8"
sudo apt-get -y install gcc-5 g++-5
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 60 --slave /usr/bin/g++ g++ /usr/bin/g++-5
cd ~
echo "Configuring the unixODBC 2.3.1 Driver Manager"