This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# $FreeBSD$ | |
# | |
# PROVIDE: carpstop | |
# REQUIRE: securelevel | |
# KEYWORDS: nostart shutdown | |
. /etc/rc.subr |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def print_related_objects(self): | |
"""Print info on the objects that are related with a ForeignKey to this instance""" | |
for link in [f for f in self._meta.get_fields() if f.one_to_many and f.auto_created and not f.concrete]: | |
related = getattr(self, link.get_accessor_name()).all() | |
print("found %s instances of %s pointing at this object - they can be accessed using obj.%s.all()" % (len(related), link.related_model, link.get_accessor_name())) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sessions = AcsSession.objects.filter(inform_eventcodes=[]) | |
while i < 2852690: | |
sessions_slice = sessions[i:i+1000] | |
print "processing number %s - %s" % (i, i+1000) | |
for acss in sessions_slice: | |
if acss.inform_eventcodes: | |
continue | |
xmlroot = fromstring(acss.acs_http_conversationlist[-1].body.encode('utf-8')) | |
soap_body = xmlroot.find('soap-env:Body', settings.SOAP_NAMESPACES) | |
inform = soap_body.find('cwmp:Inform', settings.SOAP_NAMESPACES) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo chyves windowsguest2 create 32g | |
sudo chyves windowsguest2 set ram=2G | |
sudo chyves windowsguest2 set bhyve_net_type=e1000 | |
sudo chyves windowsguest2 set loader=uefi | |
sudo chyves windowsguest2 set uefi_firmware=BHYVE_UEFI.fd | |
sudo chyves windowsguest2 set uefi_console_output=vnc | |
sudo chyves windowsguest2 set uefi_vnc_pause_until_client_connect=yes | |
sudo chyves windowsguest2 set eject_iso_on_n_reboot=3 | |
sudo chyves windowsguest2 start win2012.iso | |
sudo chyves windowsguest2 get uefi_vnc_ip |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zone "." { | |
type slave; | |
file "/usr/local/etc/namedb/slave/root.slave"; | |
masters { | |
192.5.5.241; // F.ROOT-SERVERS.NET. | |
}; | |
notify no; | |
}; | |
zone "arpa" { | |
type slave; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user@sys-dns:~$ cat /rw/config/unbound/conf.d/tls-upstream.conf | |
server: | |
ssl-upstream: yes | |
forward-zone: | |
name: "." | |
forward-addr: 89.233.43.71@853 | |
forward-first: no |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
while read line; do | |
ip=$(echo $line | cut -d " " -f 1); | |
hosts=$(echo $line | cut -d " " -f 2-); | |
zone=$(echo $hosts | tr " " "\n" | awk '{print length"\t"$0}'|sort -n|cut -f2- | head -1); | |
echo "processing zone: $zone (ip $ip - hosts $hosts)"; | |
echo "\$ORIGIN $zone." > $zone.db; | |
echo "\$TTL 1h" >> $zone.db; | |
echo "$zone. IN SOA ns.$zone. username.$zone. ( 2007120710; 1d; 2h; 4w; 1h )" >> $zone.db; |