Skip to content

Instantly share code, notes, and snippets.

View somejavadev's full-sized avatar

Hein Smith somejavadev

  • South Africa
View GitHub Profile
#!/bin/bash
# -b <integer>, bus or screen, run: ddcutil detect --verbose look for: I2C bus: /dev/i2c-9, which will evaluate to: -b 9
# setvcp 0x60, select input control
# Select source
## 0x11 hdmi
## 0x0f displayport
#Reference: https://fostips.com/shortcut-key-switch-monitor-input-source-linux/
CHOSEN_SOURCE="$1"
@somejavadev
somejavadev / post-commit
Created May 28, 2020 14:13 — forked from LordGaav/post-commit
Git hook that determines the author based on the email address in a SSH key. Doesn't work because Git doesn't check the config between pre-commit and commit.
#!/bin/sh
# Retrieve author information as Git sees it while commiting
AUTHORINFO=$(git var GIT_AUTHOR_IDENT) || exit 1
NAME=$(printf '%s\n' "${AUTHORINFO}" | sed -n 's/^\(.*\) <.*$/\1/p')
EMAIL=$(printf '%s\n' "${AUTHORINFO}" | sed -n 's/^.* <\(.*\)> .*$/\1/p')
printf "AUTHORINFO: %s\n" "${AUTHORINFO}"
printf "NAME: %s\n" "${NAME}"
printf "EMAIL: %s\n" "${EMAIL}"
@somejavadev
somejavadev / new_raspbian_user.sh
Created December 10, 2019 07:42
Creates a new user on raspbian cloning the pi user groups for this new user.
#!/bin/bash
# Creates a new user on raspbian
# cloning the pi user groups for
# this new user.
new_user=$1
adduser "$new_user"
new_groups=`groups pi`
new_groups=${new_groups:8}
public static void main(String[] args) {
System.out.print("Unsorted Random Array: ");
Random x = new Random();
int [] arr = new int [10];
for (int a = 0; a <= 7; a++) {
arr[a] = x.nextInt(5); // Change bound from 4 -> 5 since it is exclusive.
if(a<7){
System.out.print(arr[a]+", ");
[ 0.002][v][cplayer] mpv git-2018-03-22-a04ac82 Copyright © 2000-2018 mpv/MPlayer/mplayer2 projects
[ 0.002][v][cplayer] built on Fri Mar 23 22:46:33 UTC 2018
[ 0.002][v][cplayer] ffmpeg library versions:
[ 0.002][v][cplayer] libavutil 56.11.100
[ 0.002][v][cplayer] libavcodec 58.15.100
[ 0.002][v][cplayer] libavformat 58.10.100
[ 0.002][v][cplayer] libswscale 5.0.102
[ 0.002][v][cplayer] libavfilter 7.13.100
[ 0.002][v][cplayer] libswresample 3.0.101
[ 0.002][v][cplayer] ffmpeg version: git-2018-03-22-ed0e0fe
[ 0.002][v][cplayer] mpv git-2018-03-22-a04ac82 Copyright © 2000-2018 mpv/MPlayer/mplayer2 projects
[ 0.002][v][cplayer] built on Fri Mar 23 22:46:33 UTC 2018
[ 0.002][v][cplayer] ffmpeg library versions:
[ 0.002][v][cplayer] libavutil 56.11.100
[ 0.002][v][cplayer] libavcodec 58.15.100
[ 0.002][v][cplayer] libavformat 58.10.100
[ 0.002][v][cplayer] libswscale 5.0.102
[ 0.002][v][cplayer] libavfilter 7.13.100
[ 0.002][v][cplayer] libswresample 3.0.101
[ 0.002][v][cplayer] ffmpeg version: git-2018-03-22-ed0e0fe
@somejavadev
somejavadev / weather-grafana.html
Created February 20, 2018 12:36
Simple weather html to be used in a Grafana text panel. Weather gets refreshed on the global refresh of the dashboard.
<!--
A simple grafana weather panel combined by posts from this page: https://github.com/grafana/grafana/issues/1816
Just change the WOE_ID. Get one for your region here: http://www.woeidlookup.com/
-->
<script>
var WOE_ID = XXXX;
var callbackFunction = function (data) {
@somejavadev
somejavadev / VMware esxi - Patch Steps.log
Last active November 17, 2017 14:01
Quick steps to install VMware patches to a standalone esxi host via SSH
#SSH to esxi host:
vim-cmd hostsvc/maintenance_mode_enter
esxcli software vib update -d /vmfs/volumes/datastore/patch.zip
reboot
vim-cmd hostsvc/maintenance_mode_enter
SEVERE: LEAK: ByteBuf.release() was not called before it's garbage-collected. See http://netty.io/wiki/reference-counted-objects.html for more information.
WARNING: 11 leak records were discarded because the leak record count is limited to 4. Use system property io.netty.leakDetection.maxRecords to increase the limit.
Recent access records: 5
#5:
io.netty.buffer.AdvancedLeakAwareByteBuf.readRetainedSlice(AdvancedLeakAwareByteBuf.java:102)
io.netty.handler.codec.ReplayingDecoderByteBuf.readRetainedSlice(ReplayingDecoderByteBuf.java:589)
io.netty.handler.codec.mqtt.MqttDecoder.decodePublishPayload(MqttDecoder.java:414)
io.netty.handler.codec.mqtt.MqttDecoder.decodePayload(MqttDecoder.java:321)
io.netty.handler.codec.mqtt.MqttDecoder.decode(MqttDecoder.java:96)
io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:489)
2017-03-01 08:46:13,894:DEBUG:certbot.main:Root logging level set at -10
2017-03-01 08:46:13,894:INFO:certbot.main:Saving debug log to /var/log/letsencrypt/letsencrypt.log
2017-03-01 08:46:13,895:DEBUG:certbot.main:certbot version: 0.11.1
2017-03-01 08:46:13,895:DEBUG:certbot.main:Arguments: ['--server', 'https://acme-staging.api.letsencrypt.org/directory', '--webroot', '--webroot-path', '/var/www/html', '--keep-until-expiring', '--text', '-vvv', '--email', 'email@example.com', '--agree-tos', '-d', 'virtual.example.com']
2017-03-01 08:46:13,896:DEBUG:certbot.main:Discovered plugins: PluginsRegistry(PluginEntryPoint#standalone,PluginEntryPoint#manual,PluginEntryPoint#nginx,PluginEntryPoint#webroot,PluginEntryPoint#apache,PluginEntryPoint#null)
2017-03-01 08:46:13,896:DEBUG:certbot.plugins.selection:Requested authenticator webroot and installer None
2017-03-01 08:46:13,899:DEBUG:certbot.plugins.selection:Single candidate plugin: * webroot
Description: Place files in webroot directory
Interfaces: IAuthenticator,