1
Fork 0

Remove old 4-space indentation across old blog posts

This commit is contained in:
Jan-Erik Rediger 2024-01-06 19:07:51 +02:00
parent ddcdd7a0cb
commit 7cfb57b9b8
8 changed files with 126 additions and 109 deletions

View file

@ -22,13 +22,14 @@ You can find the script here: [watch.js](http://tmp.fnordig.de/watch.js). It's m
The small app.js is just this: The small app.js is just this:
socket = new io.Socket('localhost'); ```javascript
socket.connect(); socket = new io.Socket('localhost');
socket.on('message', function(data){ socket.connect();
data = JSON.parse(data); socket.on('message', function(data){
if(data.reload) data = JSON.parse(data);
window.location.reload(); if(data.reload)
}); window.location.reload();
{:lang="javascript"} });
```
So next thing: individual pages for posts, maybe templates. So next thing: individual pages for posts, maybe templates.

View file

@ -19,21 +19,23 @@ As I really like [node.js](http://nodejs.org/) I wanted to know how it handles v
It's as easy as this: It's as easy as this:
var http = require('http'); ```javascript
var server = http.createServer(function (request, response) { var http = require('http');
response.writeHead(200, {"Content-Type":"text/plain"}); var server = http.createServer(function (request, response) {
response.end ("Hello World!\n"); response.writeHead(200, {"Content-Type":"text/plain"});
console.log("Got a connection"); response.end ("Hello World!\n");
}); console.log("Got a connection");
server.listen(80, "2a01:xxxx:xxxx:xxxx::2"); });
console.log("Server running on localhost at port 80"); server.listen(80, "2a01:xxxx:xxxx:xxxx::2");
{:lang="javascript"} console.log("Server running on localhost at port 80");
```
Just pass the IPv6 address as the host parameter to `server.listen`. Just pass the IPv6 address as the host parameter to `server.listen`.
This listens on just one IP; it's possible to listen on all, similar to the `0.0.0.0` for IPv4: This listens on just one IP; it's possible to listen on all, similar to the `0.0.0.0` for IPv4:
server.listen(80, "::0"); ```javascript
{:lang="javascript"} server.listen(80, "::0");
```
Other things worth to mention: Other things worth to mention:

View file

@ -34,7 +34,6 @@ Adding syntax-highlighted code in your post now works like this:
even multi-line even multi-line
and define language after code block and define language after code block
{:lang="ruby"} {:lang="ruby"}
{:lang="text"}
And now some real highlighting to show it in action: And now some real highlighting to show it in action:

View file

@ -15,10 +15,11 @@ My SSL certificate is signed by [cacert][] (they approved me at last year's FrOS
If you're using nginx, all you need to do is adding the following lines to your config: If you're using nginx, all you need to do is adding the following lines to your config:
listen 443 ssl; ```
ssl_certificate /path/to/your/cert.pem; listen 443 ssl;
ssl_certificate_key /path/to/your/key.pem; ssl_certificate /path/to/your/cert.pem;
{:lang="text"} ssl_certificate_key /path/to/your/key.pem;
```
If you followed some of the latest news around the scene, you probably heard of the [diginotar debacle][diginotar]. This should make clear how broken the system is and how unsecure these SSL certificates can be with all those CAs around. If you followed some of the latest news around the scene, you probably heard of the [diginotar debacle][diginotar]. This should make clear how broken the system is and how unsecure these SSL certificates can be with all those CAs around.

View file

@ -33,34 +33,36 @@ etherpad runs as an own user named `etherpad` and is monitored by monit.
The monitoring is as simple as that, `/etc/monit/apps/etherpad.monit`: The monitoring is as simple as that, `/etc/monit/apps/etherpad.monit`:
check process etherpad ```
with pidfile /var/run/etherpad-lite.pid check process etherpad
start program = "/home/etherpad/etherpad-lite/daemon.sh start" with pidfile /var/run/etherpad-lite.pid
stop program = "/home/etherpad/etherpad-lite/daemon.sh stop" start program = "/home/etherpad/etherpad-lite/daemon.sh start"
if totalmem is greater than 300 MB for 10 cycles then restart # eating up memory? stop program = "/home/etherpad/etherpad-lite/daemon.sh stop"
{:lang="text"} if totalmem is greater than 300 MB for 10 cycles then restart # eating up memory?
```
And the nginx is nothing fancy at all, `/usr/local/nginx/conf/vhosts/pad.fnordig.de.conf`: And the nginx is nothing fancy at all, `/usr/local/nginx/conf/vhosts/pad.fnordig.de.conf`:
server { ```
listen 80; server {
listen [::]:80; listen 80;
listen 443 ssl; listen [::]:80;
ssl_certificate /var/certs/star_fnordig_signed.pem; listen 443 ssl;
ssl_certificate_key /var/certs/star_fnordig_signed.pem; ssl_certificate /var/certs/star_fnordig_signed.pem;
ssl_certificate_key /var/certs/star_fnordig_signed.pem;
server_name pad.fnordig.de; server_name pad.fnordig.de;
access_log /home/etherpad/etherpad-lite-log/eplite.access.log; access_log /home/etherpad/etherpad-lite-log/eplite.access.log;
error_log /home/etherpad/etherpad-lite-log/eplite.error.log; error_log /home/etherpad/etherpad-lite-log/eplite.error.log;
location / { location / {
proxy_pass http://localhost:9001/; proxy_pass http://localhost:9001/;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_buffering off; proxy_buffering off;
}
} }
{:lang="text"} }
```
My etherpad is currently running for about 22 days without any problems. I don't really use it myself and have no current statistics on outside usage of [pad.fnordig.de](https://pad.fnordig.de/). My etherpad is currently running for about 22 days without any problems. I don't really use it myself and have no current statistics on outside usage of [pad.fnordig.de](https://pad.fnordig.de/).

View file

@ -37,46 +37,51 @@ end
and start it with and start it with
proxymachine -h 0.0.0.0 -p 1234 -c your_socks_config.rb ```
{:lang="text"} proxymachine -h 0.0.0.0 -p 1234 -c your_socks_config.rb
```
Tada! You got your own [SOCKS4](http://en.wikipedia.org/wiki/SOCKS#SOCKS4) Proxy up and running. Tada! You got your own [SOCKS4](http://en.wikipedia.org/wiki/SOCKS#SOCKS4) Proxy up and running.
[@nerdsein](https://twitter.com/#!/nerdsein/status/120258441041297409) got another solution: [Mocks](http://sourceforge.net/projects/mocks/), "**M**y **O**wn so**CK**s **S**erver." [@nerdsein](https://twitter.com/#!/nerdsein/status/120258441041297409) got another solution: [Mocks](http://sourceforge.net/projects/mocks/), "**M**y **O**wn so**CK**s **S**erver."
Download it over at Sourceforge, unpack it and compile the code with: Download it over at Sourceforge, unpack it and compile the code with:
gcc -lnsl -o mocks child.c error.c misc.c socksd.c up_proxy.c ```
{:lang="text"} gcc -lnsl -o mocks child.c error.c misc.c socksd.c up_proxy.c
```
You can configure a little bit more than with proxymachine, but you can stick with the default config for now: You can configure a little bit more than with proxymachine, but you can stick with the default config for now:
```
PORT = 10080
MOCKS_ADDR = 0.0.0.0
LOG_FILE = mocks.log
PID_FILE = mocks.pid
BUFFER_SIZE = 65536
BACKLOG = 5
NEGOTIATION_TIMEOUT = 5
CONNECTION_IDLE_TIMEOUT = 300
BIND_TIMEOUT = 30
SHUTDOWN_TIMEOUT = 3
MAX_CONNECTIONS = 50
PORT = 10080 FILTER_POLICY = ALLOW
MOCKS_ADDR = 0.0.0.0 ```
LOG_FILE = mocks.log
PID_FILE = mocks.pid
BUFFER_SIZE = 65536
BACKLOG = 5
NEGOTIATION_TIMEOUT = 5
CONNECTION_IDLE_TIMEOUT = 300
BIND_TIMEOUT = 30
SHUTDOWN_TIMEOUT = 3
MAX_CONNECTIONS = 50
FILTER_POLICY = ALLOW
{:lang="text"}
See the README and the config file in the archive for comments on it. Then start it with: See the README and the config file in the archive for comments on it. Then start it with:
src/mocks -c mocks.config start ```
{:lang="text"} src/mocks -c mocks.config start
```
and kill it with: and kill it with:
src/mocks -c mocks.config shutdown ```
{:lang="text"} src/mocks -c mocks.config shutdown
```
Oh, and in case you have the possibility to just ssh to the server, you can start up a SOCKS proxy on this connection, too: Oh, and in case you have the possibility to just ssh to the server, you can start up a SOCKS proxy on this connection, too:
ssh -D1234 example.com ```
{:lang="text"} ssh -D1234 example.com
```

View file

@ -16,8 +16,9 @@ Complete taking down the machine and reinstalling everything was not an option,
By default the jabber server listens on all IPv6 addresses of the host machine, so all I needed to do here was enabling ssl-serving over IPv6 for it: By default the jabber server listens on all IPv6 addresses of the host machine, so all I needed to do here was enabling ssl-serving over IPv6 for it:
<tls port="5223">2001:0db8:85a3:08d3:1319:8a2e:0370:7344</tls> ```
{:lang="text"} <tls port="5223">2001:0db8:85a3:08d3:1319:8a2e:0370:7344</tls>
```
(this is a completeley random ipv6 addresses ;) (this is a completeley random ipv6 addresses ;)
Now to the "hard" part: the bitlbee thing. Now to the "hard" part: the bitlbee thing.
@ -28,24 +29,28 @@ But, as I told before, the server is a rather old installation and uses `netkit-
So I had to replace this one: So I had to replace this one:
apt-get install netbsd-inetd ```
{:lang="text"} apt-get install netbsd-inetd
```
One line in `/etc/inetd.conf` reads as the following: One line in `/etc/inetd.conf` reads as the following:
9999 stream tcp nowait bitlbee /usr/bin/stunnel stunnel -v 0 -l /usr/sbin/bitlbee ```
{:lang="text"} 9999 stream tcp nowait bitlbee /usr/bin/stunnel stunnel -v 0 -l /usr/sbin/bitlbee
```
This needs to be duplicated and changed to listen on v6, too. This needs to be duplicated and changed to listen on v6, too.
9999 stream tcp6 nowait bitlbee /usr/bin/stunnel stunnel -v 0 -l /usr/sbin/bitlbee ```
{:lang="text"} 9999 stream tcp6 nowait bitlbee /usr/bin/stunnel stunnel -v 0 -l /usr/sbin/bitlbee
```
And that's it. And that's it.
```
/etc/init.d/netbsd-inetd start /etc/init.d/netbsd-inetd start
/etc/init.d/jabberd14 restart /etc/init.d/jabberd14 restart
{:lang="text"} ```
and you should be ready to go. and you should be ready to go.

View file

@ -14,35 +14,37 @@ But is just to much overhead if I just need one command. So I took half an hour
Or read here: Or read here:
# original: http://tridex.net/2011-06-19/linux-netzwerke-ohne-ifconfig/ ```
# text version by @badboy_ (fnordig.de) # original: http://tridex.net/2011-06-19/linux-netzwerke-ohne-ifconfig/
# text version by @badboy_ (fnordig.de)
| Alte Syntax | Neue Syntax | Erklärung | | Alte Syntax | Neue Syntax | Erklärung |
+-----------------------------+------------------------------+---------------------------------------------+ +-----------------------------+------------------------------+---------------------------------------------+
| ifconfig eth0 up | ip link set eth0 up | Aktivieren der Netzwerkschnittstelle eth0 | | ifconfig eth0 up | ip link set eth0 up | Aktivieren der Netzwerkschnittstelle eth0 |
| ifconfig eth0 down | ip link set eth0 down | Deaktivieren der Netzwerkschnittstelle eth0 | | ifconfig eth0 down | ip link set eth0 down | Deaktivieren der Netzwerkschnittstelle eth0 |
+-----------------------------+------------------------------+---------------------------------------------+ +-----------------------------+------------------------------+---------------------------------------------+
| ifconfig eth0 | ip addr show eth0 | Zeigen der IP-Adresse von eth0 | | ifconfig eth0 | ip addr show eth0 | Zeigen der IP-Adresse von eth0 |
+-----------------------------+------------------------------+---------------------------------------------+ +-----------------------------+------------------------------+---------------------------------------------+
| ifconfig -a | ip link | Zeigen aller Netzerkschnittstellen | | ifconfig -a | ip link | Zeigen aller Netzerkschnittstellen |
+-----------------------------+------------------------------+---------------------------------------------+ +-----------------------------+------------------------------+---------------------------------------------+
| ifconfig eth0 promisc | ip link set eth0 promisc on | Einschalten des Promisc-Modus | | ifconfig eth0 promisc | ip link set eth0 promisc on | Einschalten des Promisc-Modus |
| ifconfig eth0 -promisc | ip link set eth0 promisc off | Ausschalten des Promisc-Modus | | ifconfig eth0 -promisc | ip link set eth0 promisc off | Ausschalten des Promisc-Modus |
+-----------------------------+------------------------------+---------------------------------------------+ +-----------------------------+------------------------------+---------------------------------------------+
| ifconfig eth0 192.168.1.1 | ip addr add 192.168.1.1/24 | IP-Adresse zuweisen | | ifconfig eth0 192.168.1.1 | ip addr add 192.168.1.1/24 | IP-Adresse zuweisen |
| netmask 255.255.255.0 | dev eth0 | | | netmask 255.255.255.0 | dev eth0 | |
+-----------------------------+------------------------------+---------------------------------------------+ +-----------------------------+------------------------------+---------------------------------------------+
| route | ip route show | Routen anzeigen | | route | ip route show | Routen anzeigen |
+-----------------------------+------------------------------+---------------------------------------------+ +-----------------------------+------------------------------+---------------------------------------------+
| route add default gw | ip route add default | Default-Route hinzufügen | | route add default gw | ip route add default | Default-Route hinzufügen |
| 192.168.1.10 | via 192.168.1.10 | | | 192.168.1.10 | via 192.168.1.10 | |
+-----------------------------+------------------------------+---------------------------------------------+ +-----------------------------+------------------------------+---------------------------------------------+
| route del default | ip route del default | Default-Route löschen | | route del default | ip route del default | Default-Route löschen |
+-----------------------------+------------------------------+---------------------------------------------+ +-----------------------------+------------------------------+---------------------------------------------+
| route add -net 192.168.2.0 | ip route add 192.168.2.0/24 | Netzwerk-Route anlegen | | route add -net 192.168.2.0 | ip route add 192.168.2.0/24 | Netzwerk-Route anlegen |
| netmask 255.255.255.0 | via 192.168.1.100 dev eth0 | | | netmask 255.255.255.0 | via 192.168.1.100 dev eth0 | |
| gw 192.168.1.100 dev eth0 | | | | gw 192.168.1.100 dev eth0 | | |
+-----------------------------+------------------------------+---------------------------------------------+ +-----------------------------+------------------------------+---------------------------------------------+
| route del -net 192.168.2.0 | ip route del 192.168.2.0/24 | Netzwerk-Route löschen | | route del -net 192.168.2.0 | ip route del 192.168.2.0/24 | Netzwerk-Route löschen |
| netmask 255.255.255.0 | via 192.168.1.100 dev eth0 | | | netmask 255.255.255.0 | via 192.168.1.100 dev eth0 | |
| gw 192.168.1.100 dev eth0 | | | | gw 192.168.1.100 dev eth0 | | |
```