Skip to content

Instantly share code, notes, and snippets.

@Pablo1
Pablo1 / gist:11069912
Last active August 29, 2015 14:00
Make current commit only commit in a git repository (copied from stackoverflow)
rm -rf .git
git init
git add .
git commit -m "Initial commit"
@Pablo1
Pablo1 / gist:11069734
Created April 19, 2014 00:37
post-receive hook to check out latest tree from a bare repository into a working directory for a web server other process. chmod + x hooks/post-receive to make executable.
GIT_WORK_TREE=/var/www/www.example.org git checkout -f
@Pablo1
Pablo1 / addStaticArp
Last active April 6, 2023 21:19
Mikrotik RouterOS Script - Add Static DHCP Leases to ARP List This script will update the ARP List with all static, enabled leases. It makes the changes in place (i.e. it doesn't delete all the ARP entries first) to minimize disruptions. Limitation of the script is that the interface for the ARP entry needs to be hardcoded for now.
:local wanInterfaceName "ether1_wan";
# Remove ARP entries that do not have static DHCP leases or are disabled
:foreach arpId in=[/ip arp find] do={
#Don't remove the dynamic entry on the WAN side
:if ([/ip arp get $arpId interface] != $wanInterfaceName) do={
@Pablo1
Pablo1 / dnsToAddressList
Created April 18, 2013 05:49
Mikrotik RouterOS Script - Sync Address List from DNS Lookup Results - CNAME and A Records This script might come in handy if you're trying to use domain names in firewall rules. To use this script you might write a script like the one below and schedule it. Be sure to declare three globals first : ListName, Servers, and Done. ListName and Serve…
:global ListName
:global Servers
:global Done
#has $Done been initialized?
:if ([:typeof $Done] != "boolean") do={
:set Done true;
}
#make sure previous runs have finished