Skip to content

Instantly share code, notes, and snippets.

@hfreire
hfreire / InstallCert.java
Created August 20, 2016 13:53
Install a certificate into a Java Keystore
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
@hfreire
hfreire / kodi.sh
Last active December 24, 2017 13:20
AirPlay to Kodi with cURL
#!/bin/sh
KODI_HOSTNAME=$1
HLS_URL=$2
curl -X \
-H "Content-Type: text/parameters" \
-d "Content-Location: $HLS_URL" \
"http://$KODI_HOSTNAME:36667/play" -v
@hfreire
hfreire / rpi-hdmi.sh
Last active December 24, 2017 13:20
Enable/disable your Raspberry PI HDMI output
#!/bin/sh
is_hdmi_output_off ()
{
tvservice -s | grep "TV is off" >/dev/null
}
case $1 in
stop)
tvservice -o
@hfreire
hfreire / rpi-tv.sh
Last active December 24, 2017 13:20
Power on/off your TV through your Raspberry PI
#!/bin/sh
CECCLIENT=$(which cec-client)
power_on () {
echo "on 0" | $CECCLIENT -s -d 1 >/dev/null
}
power_off () {
echo "standby 0" | $CECCLIENT -s -d 1 >/dev/null
@hfreire
hfreire / use_bash_from_macports_in_osx.sh
Created May 29, 2018 19:52
Use bash from MacPorts in OSX
# Install latest bash version using macports
sudo port install bash
# Add macports bash as an available shell interpreter
echo /opt/local/bin/bash >> /etc/shells
# Set macports bash as the default shell interpreter
chsh -s /opt/local/bin/bash
# Open a new terminal window
@hfreire
hfreire / load_test_aftonbladet.sh
Last active August 22, 2018 20:15
HTTP load testing with Vegeta
# Load test Aftonbladet's website with HTTP GET requests and show error report
echo "GET https://www.aftonbladet.se" | vegeta attack -duration=60s | tee results.bin | vegeta report

Keybase proof

I hereby claim:

  • I am hfreire on github.
  • I am hfreire (https://keybase.io/hfreire) on keybase.
  • I have a public key ASD91X_VarQXA8-IS0qsaLzI6pLM8ao2kbWpwZn4eCNPpgo

To claim this, I am signing this object:

@hfreire
hfreire / limego-consent-all.js
Created November 2, 2018 08:10
🎃 Hack 🤘 to consent ✉️ e-mail and data processing for 🤷🏼‍♂️ contact persons in 📚 Lime Go CRM https://www.lime-go.se
@hfreire
hfreire / wakeonlan_qnap_nas.sh
Last active January 19, 2019 11:04
Wake-on-LAN (WoL) QNAP NAS from OSX
curl -O https://raw.githubusercontent.com/jpoliv/wakeonlan/master/wakeonlan
perl wakeonlan 24:5E:BE:00:00:00
@hfreire
hfreire / git_commit_12_hours_ago.sh
Created January 19, 2019 11:08
Do a git commit 12 hours ago
GIT_AUTHOR_DATE=$(date -v '-12H' '+%a %h %d %H:%M:%S %Y %z') \
GIT_COMMITTER_DATE=$(date -v '-12H' '+%a %h %d %H:%M:%S %Y %z') \
git commit -am "feat: better late than ever"