Skip to content

Instantly share code, notes, and snippets.

@dragonauta
dragonauta / dhcp_lease_to_static_dns
Created June 25, 2020 19:09
DHCP lease to static DNS entry in Mikrotik
# SOURCE: https://blog.pessoft.com/2019/09/06/mikrotik-script-automatic-dns-records-from-dhcp-leases/
# When "1" all DNS entries with IP address of DHCP lease are removed
:local dnsRemoveAllByIp "1"
# When "1" all DNS entries with hostname of DHCP lease are removed
:local dnsRemoveAllByName "1"
# When "1" addition and removal of DNS entries is always done also for non-FQDN hostname
:local dnsAlwaysNonfqdn "1"
# DNS domain to add after DHCP client hostname
:local dnsDomain "mydomain.lan"
# DNS TTL to set for DNS entries
@dragonauta
dragonauta / dmenu_findfile.sh
Created October 31, 2017 23:05
dmenu file finder
#!/bin/bash
# dmenu_findfile.sh for dmenu.
# Find every file in your $HOME
# author: Diego Rucci (dragonauta) <dragonauta.x@gmail.com>
# It shows dmenu with a width of 600px, 30 lines of text on top of screen.
# Idea taken from Chrysostomus
# https://github.com/Chrysostomus/bspwm-scripts/blob/master/bin/finder
# Requires: dmenu, xdg-utils
#
# You can customize:
@dragonauta
dragonauta / upgrade-guacamole.sh
Last active May 10, 2017 21:26
upgrade guacamole
#!/bin/bash
# for upgrading guacamole (https://guacamole.incubator.apache.org/)
# change version and execute
# should download war and deploy into tomcat8
# and download server, and install it
VER="0.9.12-incubating"
DEPS="libfreerdp-dev libpango1.0-dev libavcodec-dev libavutil-dev libssh2-1-dev libssl-dev libswscale-dev libvncserver-dev libvorbis-dev libpulse-dev libwebp-dev"
apt-get install $DEPS
cd /var/lib/tomcat8/webapps
@dragonauta
dragonauta / gist:882821d0d20b8928deae4046b1ec89c4
Last active July 29, 2016 21:26
look at folder and list JPG
<?php
$directory = "sample_photos/images/";
$images = glob($directory . "*.jpg");
foreach($images as $image)
{
$t = str_replace("images", "thumbnails", $image);
echo "<a href='" . $image . "' title='test' rel='lightbox[Brussels]'><img src='" . $t . "' /></a>'";
}
?>
@dragonauta
dragonauta / smart.sh
Created February 4, 2016 11:05
Smart values
#!/bin/bash
GREPVARS1='overall-health|ATTRIBUTE_NAME|Raw_Read_Error_Rate|Reallocated_Sector_Ct|Load_Retry_Count'
GREPVARS2='Power_On_Hours|Temperature_Celsius'
DEVICE=/dev/sda
sudo smartctl -AH $DEVICE | grep -E $GREPVARS1
sudo smartctl -A $DEVICE | grep -E $GREPVARS2
@dragonauta
dragonauta / wget-bandwidth-limited
Created May 22, 2015 13:22
Download with WGET using bandwidth limit
#!/bin/bash
LIMIT=<your limit bandwidth>
URL=<your download url>
wget -c --limit-rate=$LIMIT $URL
@dragonauta
dragonauta / notify-load
Created May 22, 2015 13:16
Notifies system load and 3 top processes
DISPLAY=:0 notify-send "$(cat /proc/loadavg)" "$(ps hax o comm k -time | head -n 3)"
@dragonauta
dragonauta / git.profile
Created May 15, 2015 16:55
Aliases for managing my ZSH user profile
git.clone.profile='mkdir -p $HOME/git; git clone git@gitserver:/home/git/profile.git; chmod 600 $HOME/.ssh/id_rsa*'
git.fetch.profile='cd $HOME/git/profile; git fetch --all; git reset --hard origin/master; chmod 600 $HOME/.ssh/id_rsa*'
git.push.profile='cd $HOME/git/profile; git add .; git commit -m "$(date +%F)"; git push origin master'
@dragonauta
dragonauta / arch-chroot-grub
Created April 25, 2015 20:30
Arch grub rescue
Boot from LiveCD
mount root partition
# mount /dev/sda1 /mnt
Chroot
# arch-chroot /mnt
# grub-install /dev/sda
@dragonauta
dragonauta / brokenlinks.sh
Created April 21, 2015 17:42
Find broken links into local folder+subfolders