Skip to content

Instantly share code, notes, and snippets.

View kronenpj's full-sized avatar

Paul Kronenwetter kronenpj

View GitHub Profile
@wankdanker
wankdanker / ksmstat
Created September 9, 2011 18:12
bash script to calculate ksm stats in kb
#!/bin/bash
if [ "$1" != "" ]; then
echo "
----------------------------------------------------------------------------
http://www.kernel.org/doc/Documentation/vm/ksm.txt :
The effectiveness of KSM and MADV_MERGEABLE is shown in /sys/kernel/mm/ksm/:
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active July 31, 2024 13:08
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@Zearin
Zearin / python_decorator_guide.md
Last active July 24, 2024 03:06
The best explanation of Python decorators I’ve ever seen. (An archived answer from StackOverflow.)

NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.


Q: How can I make a chain of function decorators in Python?


If you are not into long explanations, see [Paolo Bergantino’s answer][2].

@jtyr
jtyr / VirtualBoxKickstart.md
Last active February 23, 2024 01:38
How to use kickstart in VirtualBox

How to use kickstart in VirtualBox

This short howto describes how to install VMs via kickstart in VirtualBox. It's using PXE functionality built into the NAT network mode of the VirtualBox. The following instructions apply to CentOS installation but it should work for any RedHat-based distro.

Prepare directory structure

@vasi
vasi / mount.backuppc
Created January 4, 2015 18:33
Allow adding backuppcfs.pl filesystems to fstab
#!/usr/bin/perl
use warnings;
use strict;
use Getopt::Long;
use Data::Dumper;
my $debug = 0;
# Valid options for backuppcfs
@gbaman
gbaman / HowToOTG.md
Last active July 19, 2024 11:47
Simple guide for setting up OTG modes on the Raspberry Pi Zero

Raspberry Pi Zero OTG Mode

Simple guide for setting up OTG modes on the Raspberry Pi Zero - By Andrew Mulholland (gbaman).

The Raspberry Pi Zero (and model A and A+) support USB On The Go, given the processor is connected directly to the USB port, unlike on the B, B+ or Pi 2 B, which goes via a USB hub.
Because of this, if setup to, the Pi can act as a USB slave instead, providing virtual serial (a terminal), virtual ethernet, virtual mass storage device (pendrive) or even other virtual devices like HID, MIDI, or act as a virtual webcam!
It is important to note that, although the model A and A+ can support being a USB slave, they are missing the ID pin (is tied to ground internally) so are unable to dynamically switch between USB master/slave mode. As such, they default to USB master mode. There is no easy way to change this right now.
It is also important to note, that a USB to UART serial adapter is not needed for any of these guides, as may be documented elsewhere across the int

@robinsmidsrod
robinsmidsrod / make_vbox.sh
Created May 16, 2016 11:47
Build script for custom iPXE ROM for VirtualBox
make_vbox() {
pushd "$HOME/src/forked/ipxe/src" >/dev/null &&
#make bin/intel--virtio-net--pcnet32.dsk EMBED=../nic-menu.ipxe &&
make CONFIG=vbox bin/intel--virtio-net--pcnet32.isarom && #EMBED=config/vbox/embedded.ipxe &&
#perl util/padimg.pl --verbose --blksize 4096 bin/intel--virtio-net--pcnet32.isarom &&
echo "Max size of VirtualBox ROM is 56KB, 57344 bytes" &&
ls -l bin/intel--virtio-net--pcnet32.isarom &&
prefix=$(date +%Y%m%d-%H%M%S) &&
mkdir -p /ipxe/$prefix &&
cp -v bin/intel--virtio-net--pcnet32.isarom /ipxe/$prefix/ &&
@muff1nman
muff1nman / chromecast-ssdp.xml
Created August 20, 2017 00:04 — forked from jgmel/chromecast-ssdp.xml
FirewallD Chromecast RHEL7/Centos7
<?xml version="1.0" encoding="utf-8"?>
<service>
<short>chromecast-ssdp</short>
<port protocol="udp" port="1900"/>
<destination ipv4="239.255.255.250/32"/>
</service>
@AnatomicJC
AnatomicJC / android-backup-apk-and-datas.md
Last active July 29, 2024 16:31
Backup android app, data included, no root needed, with adb

Backup android app, data included, no root needed, with adb

Note: This gist may be outdated, thanks to all contributors in comments.

adb is the Android CLI tool with which you can interact with your android device, from your PC

You must enable developer mode (tap 7 times on the build version in parameters) and install adb on your PC.

Don't hesitate to read comments, there is useful tips, thanks guys for this !

@spali
spali / 10-wancarp
Last active July 25, 2024 07:36
Disable WAN Interface on CARP Backup
#!/usr/local/bin/php
<?php
require_once("config.inc");
require_once("interfaces.inc");
require_once("util.inc");
$subsystem = !empty($argv[1]) ? $argv[1] : '';
$type = !empty($argv[2]) ? $argv[2] : '';