Skip to content

Instantly share code, notes, and snippets.

@robinsmidsrod
robinsmidsrod / _INSTALL.md
Last active June 16, 2024 09:00
Bootstrapping full iPXE native menu with customizable default option with timeout (also includes working Ubuntu 12.04 preseed install)

Add the following chunk to your existing ISC dhcpd.conf file.

if exists user-class and ( option user-class = "iPXE" ) {
    filename "http://boot.smidsrod.lan/boot.ipxe";
}
else {
    filename "undionly.kpxe";
}

(or see https://gist.github.com/4008017 for a more elaborate setup

@sebfisch
sebfisch / replace-classes-in-apk.sh
Created May 22, 2012 08:58
Replaces classes in Android Package Files
#!/bin/bash
# Replaces classes in Android Package Files
# (c) Sebastian Fischer, CC-BY
# Can be used to rebuild an App with a modified version of a used library,
# as required for closed works that link to an LGPL library.
# Depends on: https://code.google.com/p/dex2jar/
@willurd
willurd / web-servers.md
Last active June 24, 2024 11:36
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@2xyo
2xyo / python-install-2.7.5.sh
Last active August 13, 2017 09:38
Python 2.7.5 from source + virtualenv with Debian GNU/Linux 6.0.7 (squeeze)
#!/usr/bin/env bash
cd /tmp
# Install dependencies
aptitude -y install build-essential python-pip libmysqlclient-dev libadns1-dev \
python-dev libreadline-dev libgdbm-dev zlib1g-dev libsqlite3-dev \
libssl-dev libbz2-dev libncurses5-dev libdb-dev
# Download latest version
@mqu
mqu / usb-auto-backup
Last active October 3, 2023 14:43
usb-auto-backup script - a script connected to UDEV daemon, running rsync backup when user insert USB drive.
TODO :
- manage user notification ; notify-send not really working ; current alternative either.
- display hostid used to customize usb backup script.
INSTALL
- copy usb-auto-backup script to /usr/local/bin,
- create an partition on an USB drive named "backup" ; get id (/dev/sddX) -> will be needed in udev.rules
- identity your drive information for UDEV-rules using : udevadm info -a -p $(udevadm info -q path -n /dev/sdXX)
- create an UDEV rule : /etc/udev/rules.d/99-usb-auto-backup.rules like this one :
@teroka
teroka / dell_specs.py
Created November 8, 2014 19:23
Dell API: Original Config for Hardware
#!/usr/bin/env python
# Script to query Dell's API for the hardware's original config.
# Just drop your service tag as parameters for the script and go.
import sys
import requests
APIKEY = 'd676cf6e1e0ceb8fd14e8cb69acd812d'
URL = 'https://api.dell.com/support/v2/assetinfo/detail/tags.json?svctags={0}&apikey=' + APIKEY
@ernetas
ernetas / telegraf-xen
Last active January 19, 2021 07:20
Telegraf Xen exec monitoring script
#!/usr/bin/env python3
import socket
hostname = socket.gethostname()
import subprocess
import time
def print_influx_data(xendomain, item, value):
global timestamp
print('xen_' + item + ',domain=' + xendomain + ',host=' + hostname + ' ' + value + ' ' + timestamp)
#!/bin/bash
# Adjust homserver, room, and accesstoken to your particular setup
# Script is expecting data to be piped in on STDIN
# Example:
# echo "some text" | sendmatrix
msgtype=m.text
homeserver=<homeserver>
room=<room id>
const fs = require('fs');
const replace = [
// fix spaces after @, # and ()
[/@ %s/g, '@%s'],
[/@% s/g, '@%s'],
[/`@ %s '/g, '`%s`'],
[/"@ %s/g, '"@%s'],
@Elektordi
Elektordi / jwt-decode.sh
Last active July 31, 2023 13:51
Decode jwt from command line
#!/bin/sh
token="$1"
if [ -z "$token" ]; then
read token
fi
echo $token | jq -R 'gsub("-";"+") | gsub("_";"/") | split(".") | select(length > 0) | .[0],.[1] | @base64d | fromjson'
echo