Simple recursive DNS server with Unbound DNS
By admin | July 30, 2020
This is a simple configuration for running a recursive DNS server (passes DNS requests to another server and caches responses) with the Unbound DNS server.
Installation (Ubuntu):
sudo apt-get install -y unbound
Open the config
sudo vim /etc/unbound/unbound.conf
Configuration
Replace 8.8.8.8 below with the desired upstream DNS server.
# The following line includes additional configuration files from the # /etc/unbound/unbound.conf.d directory. #include: "/etc/unbound/unbound.conf.d/*.conf" # NOTE: needed to comment out the above line avoid a "status: SERVFAIL" response server: # Enable verbose debugging messages verbosity: 1000 # Run on all interfaces interface: 0.0.0.0 # Hide the server name and version hide-identity: yes hide-version: yes # Who should be able to query the server access-control: 0.0.0.0/0 allow do-ip4: yes do-ip6: no do-udp: yes # Enable this to support TCP DNS which is required in some applications do-tcp: yes # Allow forwarding to another 127.0.0.0/8 DNS server (e.g. another local dnsmasq or systemd-resolve) do-not-query-localhost: no forward-zone: name: "." # Replace 8.8.8.8 with your desired upstream DNS server # You can have multiple forward-addr lines forward-addr: 8.8.8.8@53
Starting the server
sudo systemctl restart unbound
Debugging / Troubleshooting
Query the server
dig @your_server_here example.com
Read the DNS server log
sudo systemctl status unbound -n 50
References:
Topics: Linux | No Comments »
Generating POT files for WordPress plugins
By admin | July 6, 2020
The easiest non-GUI way appears to be using WP CLI.
Run the following in the plugin folder:
wp i18n make-pot . output.pot
Topics: HTTP (Internet) | No Comments »
Make fails silently
By admin | February 28, 2017
Run make <...> -d &> log.txt
and examine the log. Likely there is some prerequisite which is missing, in the form of “File `foo’ does not exist.”
Topics: Linux | No Comments »
LaTeX macros ending in numbers
By admin | February 13, 2016
Only letters are directly permitted in macro names, but by using csname to create definitions along with a variable command, we can simulate them.
First, define the macros with numbers using \csname:
\expandafter\def\csname xR1\endcsname{-3} \expandafter\def\csname xR2\endcsname{9}
Now, create a command which takes in one variable argument, and simply expands it to call the appropriate macro (“xR” + variable) defined above.
\newcommand{\xR}[1]{\expandafter\csname xR#1\endcsname}
And to use the macros:
The first is \xR1 and the second is \xR2.
Topics: Linux | No Comments »
Phabricator LDAP (and other) account integration table
By admin | January 17, 2016
phabricator_user.user_externalaccount
See also https://secure.phabricator.com/T4279
For LDAP, the following structure is used:
- id – auto-increment
- phid – random unique id
- userPHID – associated user or NULL
- accountType – “ldap”
- accountDomain – “self”
- accountSecret` – random characters
- accountID – LDAP username
- displayName – NULL
- dateCreated – Unix timestamp
- dateModified – Unix timestamp
- username – registration pre-fill for username
- realName – registration pre-fill for real name
- email – NULL
- emailVerified – 0
- accountURI – NULL
- profileImagePHID – NULL
- properties – “[]”
Topics: PHP | No Comments »
Possible crash in method_exists() with PHP 5.3
By admin | August 9, 2014
Apparently in some versions of PHP 5.3, calling method_exists() on a class which doesn’t exist seems to cause a crash. The solution, seen here, apparently involves checking class_exists() to prevent a potentially crashing call to method_exists().
This particular bug was causing the administration page of the MathJax-LaTeX WordPress plugin to be blank in the admin interface.
The trick is to replace the two lines in mathjax-latex-admin.php lines 91-92:
$wp_latex_disabled = method_exists('WP_LaTeX','init') ? "disabled='true'" : ""; $wp_latex_disabled_warning = method_exists('WP_LaTeX','init') ? "Disable wp-latex to use this syntax." : "";
with:
$wp_latex_disabled = (class_exists('WP_LaTeX', false) && method_exists('WP_LaTeX','init')) ? "disabled='true'" : ""; $wp_latex_disabled_warning = (class_exists('WP_LaTeX', false) && method_exists('WP_LaTeX','init')) ? "Disable wp-latex to use this syntax." : "";
Topics: PHP | No Comments »
Disable dragging of an element in JSXGraph
By admin | July 20, 2014
Set the attribute ‘fixed‘ to true in JXG.GeometryElement:
var line = board.create('line', [ [0,0], [1,1] ], {dash:0, strokeColor:"#FF0000", strokeWidth:3, fixed: true});
or
var line = board.create('line', [ [0,0], [1,1] ], {dash:0, strokeColor:"#FF0000", strokeWidth:3}); line.setAttribute({ fixed: true }); board.update();
Topics: (X)HTML, Windows | No Comments »
Reverse engineering the Fischertechnik blinker
By admin | July 13, 2014
The Fischertechnik blinker comes in a enclosed case with no other sensory inputs with two wires, a yellow wire and a blue wire.
As such, I reverse engineered the Fischertechnik blinker to understand how it works through desoldering, a camera, and a lot of drawing on the GIMP.
It turns out that the blinker is intended to be used like a switch in a series circuit before a load, with the yellow lead being the positive end and the blue lead being the negative end.
The main idea here is that the board uses a 555 timer (555C EZ606 with STMicroelectronics logo, surface-mounted) with fixed frequency (fixed R1, R2 and C) in astable mode to control a BSP 75N MOSFET transistor.
The power supply for the ICs is controlled in parallel with a diode and a 470Ω resistor to protect the ICs, while the MOSFET controls the connection to the other lead.
It features an unknown-model fuse (VW UG4 GP613) on the emitter of the transistor, presumably to protect the circuit from excess.
A diode and 100 µF capacitor cap are present, possibly to smooth out the power input for the ICs during temporary dislocations. Considering that it is a Fischertechnik component, its purpose is probably to ensure continued reliability when it is handled roughly, shaken, and dropped by students.
After complete disassembly:
With traces and PCB features:
Schematic:
Since C is a generic-looking ceramic capacitor with no markings, its capacitance was estimated by using the period.
The light was measured to blink 100 times in 41.21 seconds, giving:
$$
T = 0.4121 \text{s} \\
f = 2.426 \text{s}^{-1}
$$
Given R1 = 1 MΩ and R2 = 1.2 MΩ from above and f = 2.426, we can calculate C using the following equation:
$$
f = \dfrac{1}{\ln 2 * C * (R_1 + 2*R_2)}
$$
C then works out to about 0.175 µF.
Topics: Other | No Comments »
Reverse proxy with HTML rewriting using Apache
By admin | May 25, 2014
<VirtualHost *:80> ServerName foo.example.com ... other directives ... ProxyHTMLEnable On (comment in some cases) SetOutputFilter proxy-html SetOutputFilter inflate;proxy-html;deflate (for compression issues - e.g. The page you are trying to view cannot be shown because it uses an invalid or unsupported form of compression) ProxyHTMLURLMap http://192.168.12.34/myfolders/ / ProxyHTMLURLMap /myfolders / </VirtualHost>
Topics: Linux | No Comments »
How to get the classic Firefox look back
By admin | November 20, 2013
While all the latest dynamic changes (such as the new Australis UX) may be interesting, you may be looking to get that classic Firefox look back for productivity reasons. Here is a list of recommended addons to restore your Firefox back to something to do work with:
- Classic Theme Restorer – Removes many annoying Australis features like the removal of the title bar and tabs on top.
- Set ‘Squared tabs (classic)‘
- Check ‘Tabs not on top‘
- Un-check ‘Tabs in titlebar‘
- Under Application button, set ‘Button disabled‘
- Check ‘Addon-bar‘
- Check ‘Movable back-forward button‘
- Classic Bookmarks Button – Restores the bookmarks button previously present in Firefox.
- Find it in ‘Customize Nightly‘
- Element Properties – Restores the ‘Properties’ item in the context menu.
- NoScript – Restores the control over whether you want to run JavaScript (removed in recent Firefox by default).
- Status-4-Evar – Brings back the status bar menu that we all love and hate.
- Find the widgets ‘Status Text’, ‘Progress Meter’ in ‘Customize Nightly‘
- Un-check ‘Enable protocol hiding‘
Topics: HTTP (Internet) | No Comments »