Skip to content

Instantly share code, notes, and snippets.

View HendrikHaase's full-sized avatar
🏠
Working from home

Hendrik HendrikHaase

🏠
Working from home
View GitHub Profile
@HendrikHaase
HendrikHaase / wireguard.conf
Created November 13, 2022 16:37 — forked from nealfennimore/wireguard.conf
Wireguard VPN - Forward all traffic to server
# ------------------------------------------------
# Config files are located in /etc/wireguard/wg0
# ------------------------------------------------
# ---------- Server Config ----------
[Interface]
Address = 10.10.0.1/24 # IPV4 CIDR
Address = fd86:ea04:1111::1/64 # IPV6 CIDR
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE; ip6tables -A FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -A POSTROUTING -o eth0 -j MASQUERADE # Add forwarding when VPN is started
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE; ip6tables -D FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -D POSTROUTING -o eth0 -j MASQUERADE # Remove forwarding when VPN is shutdown
@HendrikHaase
HendrikHaase / experimentalDecorators.jpg
Last active April 6, 2021 11:17
experimentalDecorators Typescript warning, Visual Studio
experimentalDecorators.jpg
@HendrikHaase
HendrikHaase / proxmox-add-thermal-stats-to-summary.md
Last active July 20, 2023 14:09
proxmox add thermal stats to summary

proxmox add thermal stats to summary

apt install lm-sensors


open file

nano /usr/share/perl5/PVE/API2/Nodes.pm

getTimezoneString(): string {
// returns +xx:xx or -xx:xx
let offsetInMinutes = moment().local().utcOffset();
let direction: number = (offsetInMinutes < 0 ? -1 : 1);
let hours: number = Math.floor(Math.abs(offsetInMinutes) / 60);
let minutes: number = Math.abs(offsetInMinutes) % 60;
return (direction < 0 ? "-" : "+") + (hours < 10 ? "0" + hours : hours) + ":" + (minutes < 10 ? (minutes == 0 ? "00" : "0" + minutes) : minutes);
}
/** adjust tinymce - tags */
add_filter('tiny_mce_before_init', 'tiny_mce_remove_unused_formats' );
function tiny_mce_remove_unused_formats($init) {
// Add block format elements you want to show in dropdown
$init['block_formats'] = 'Paragraph=p;Heading 2=h2;Heading 3=h3;Pre=pre';
return $init;
}
@HendrikHaase
HendrikHaase / a.php
Created January 29, 2019 16:10
Laravel 5.2 - update model value without updating updated_at if $timestamps = true on model
<?php
//For Laravel 5.x users who are trying to perform a Model::update() call, to make it work you can use
Model::where('id', '1')
->update([
'val' => $val,
'updated_at' => \DB::raw('updated_at')
]);
@HendrikHaase
HendrikHaase / body.html
Created November 28, 2018 11:14
simple but effective "anti-flashing-styles" loader
<body>
<div id="loader"></div>
...
<script type="text/javascript">
(function() {
document.getElementById("loader").remove();
})();
</script>
### CUSTOM REDIRECT - ADD TRAILING SLASH IF MISSING
RewriteCond %{REQUEST_URI} (some-url-fragment)$
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1/ [R=301,L]
(function($){
$.fn.shuffle = function() {
var allElems = this.get(),
getRandom = function(max) {
return Math.floor(Math.random() * max);
},
shuffled = $.map(allElems, function(){
var random = getRandom(allElems.length),