Sometimes I stumble upon interesting commands, settings or procedures that might be useful in the future as well, so I'll document them here and who knows, maybe someone else will find something interesting here as well.

Once Chrome noticed your site using HTTPS it will keep redirecting you to HTTPS even if the webserver doesn't even host HTTPS sites. You can clear the cache and cookies, try to delete the HSTS policy, but nothing works, except this:

  1. Open site and get redirected to HTTPS
  2. Open the developer tool (F12)
  3. Right click on the refresh button next to the address bar
  4. Click on "Empty Cache and Hard Reload"
  5. Browse to the none HTTP site

Credit gots to Galaxy Internet

Here's a short batch script that allows you to convert a video to a GIF with FFmpeg.

SET filters="fps=%4,scale=%3:-1:flags=lanczos"
ffmpeg -v warning -i %1 -vf "%filters%,palettegen" -y palette.png
ffmpeg -v warning -i %1 -i palette.png -lavfi "%filters% [x]; [x][1:v] paletteuse" -y %2
DEL palette.png

Usage: togif.bat <input.mp4> <output.gif> <width> <fps>

VariBright is responsible for automatically adjusting the brightness of your display depending on the content shown on the screen. While an interesting idea, it generally doesn't work as expected and leads to a very annoying brightness pumping.

  1. Open the registry editor by pressing Win+R and typing in regedit
  2. Browse to: HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318}\0000
  3. Right-Click on the 0000 key (it looks like a folder).
  4. Select New->Dword.
  5. Name the new registry entry PP_VariBrightFeatureEnable
  6. Double-click on the PP_VariBrightFeatureEnable entry you just created.
  7. Make sure it has a value of 0
  8. Click OK, close the registry editory, and restart the machine.

Credit goes to Luke Taylor

  1. Close the Logitech Gaming Software
  2. Start your favorite text editor with admin privileges
  3. Open the file C:\Program Files\Logitech Gaming Software\Resources\G930\Manifest\Device_Manifest.xml
  4. Set turnOffInterval="900" to 0 or any other time interval in seconds
  5. Save and restart the Logitech Gaming Software
  6. Don't forget to manually turn off your headset after use!
  1. Windows Key
  2. Search for your application
  3. Ctrl + Shift + Enter
  4. Wait for the UAC window
  5. Select "Yes"
  1. Start Notepad as administrator
  2. Open the hosts file: %SystemRoot%\System32\drivers\etc\hosts
  3. Add the follow line and save it
0.0.0.0 ads.viber.com
  1. Start Notepad as administrator
  2. Open the hosts file: %SystemRoot%\System32\drivers\etc\hosts
  3. Add the follow two lines and save it
0.0.0.0 rad.msn.com
0.0.0.0 apps.skype.com
  1. Open an elevated CMD session
  2. Run powercfg /waketimers
  3. Windows Key + R
  4. Type in taskschd.msc and press Enter
  5. Find the corresponding entries and disable them
  6. Some application might activate the task again, so make sure to disable it in the given application as well
  1. Open an elevated CMD session
  2. Run powercfg /devicequery wake_armed
  3. Windows Key + R
  4. Type in devmgmt.msc and press Enter
  5. Find the corresponding device, Right Click on it and open their properties
  6. Go to the Power Management tab
  7. Uncheck Allow this device to wake the computer
  1. Close PortableApps
  2. Open the location of your PortableApps installation in Explorer
  3. Browse to the directory X:\PortableApps\PortableApps.com\Data
  4. Open the file PortableAppsMenu.ini in your favorite text editor
  5. Change the GlobalHotKey key combination
  6. Save the file and close the editor
  7. Start PortableApps again
Allowed key combinations are: CTRL-ALT-SPACE, CTRL-ALT-P, CTRL-ALT-M, CTRL-SPACE, WIN-ALT-SPACE and DISABLED.
Note that WIN-ALT-SPACE will not work on many versions of Windows, but for me it works on Windows 10.

When you use a Windows Key + hotkey in Windows 10, you'll get a suggestion of what other window you want to snap. This can be helpful, but is most of the time just annoying and requires you to press ESC. Here's how you disable Snap Assist.

  1. Open the Settings app from the Start Menu
  2. Select the System category
  3. On the left side select Multitasking
  4. Disable the third option "When I snap a window, show what I can snap next to it"
git fetch origin pull/<ID>/head:<BRANCH>

Get disk information

sudo fdisk -l

Partition the disk

parted /dev/sdX mklabel gpt
parted /dev/sdX mkpart primary 0% 100%
parted /dev/sdX print
parted /dev/sdX name 1 CoolName

Format the partition

mkfs -t ext4 -E lazy_itable_init=1 /dev/sdX1

Source #1, #2

Local

ssh -i ~/.ssh/id_rsa -f -N -R 9999:localhost:22 remote.user@remote.host

Remote

ssh -i ~/.ssh/id_rsa -p 9999 local.user@localhost

AutoSSH Local

autossh -- -i ~/.ssh/id_rsa -o ControlPath none -R 9999:localhost:22 remote.user@remote.host -N

Generate

ssh-keygen -t rsa -b 4096

Upload

ssh-copy-id user@host

OR

cat ~/.ssh/id_rsa.pub | ssh user@host "mkdir -p ~/.ssh && cat >>  ~/.ssh/authorized_keys"

See also the GitHub help page and the Digital Ocean help page.

sudo netstat -taupen

Installations

Install Node.js

sudo apt-get install nodejs nodejs-legacy

Install NPM - Node Package Manager

curl https://www.npmjs.com/install.sh | sudo sh

Install PM2 - To manage and daemonize Node.js apps

sudo npm install pm2 -g

Start PM2 with the OS

sudo pm2 startup debian

Install proxy mod (might already be installed)

sudo apt-get install libapache2-mod-proxy-html

Setting up the Node.js app

Create example app

var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
}).listen(8080, '127.0.0.1');
console.log('Server running at http://127.0.0.1:8080/');

Test app

node hello.js

Setup app with PM2

pm2 start hello.js

Additional PM2 commands

pm2 restart <app name>
pm2 info <app name>
pm2 stop <app name>
pm2 list
pm2 monit

Configure Apache

Activate proxy mod

sudo a2enmod proxy proxy_html
sudo service apache2 restart

Adjust virtualhost

<VirtualHost *:80>
    ServerAdmin admin@domain.tld
    ServerName domain.tld
    ServerAlias www.domain.tld
 
    ProxyRequests off
 
    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>
 
    <Location />
        ProxyPass http://127.0.0.1:8080/
        ProxyPassReverse http://127.0.0.1:8080/
    </Location>
</VirtualHost>

Reload apache configuration

sudo service apache2 reload

For some firewall rules you're required to provide the public IP address. With a dynamic IP you would have to update the firewall rule every time the IP changes, which can be rather annoying and with many rules also time consuming.

Instead it's best to just add a new address list which then can be referenced and if the IP changes there's only one place you need to update.

/ip firewall address-list add address <IP>

The command line will then prompt you for a name, pick something descriptive like for example PUBLIC.

/ip firewall nat

add chain=srcnat src-address=192.168.1.0/24 dst-address=192.168.1.10 protocol=tcp out-interface=bridge1 action=masquerade

add chain=dstnat dst-address-list=PUBLIC protocol=tcp dst-port=80880 action=dst-nat to-address=192.168.1.10

EdgeOS is basically a modified Debian system and supports a lot of the commonly known commands.

The most important command or rather key is the ?. It will list all available commands in the given situation.

With configure you switch into configuration mode where you can change the router settings. Leave this mode with exit.

Use commit to apply changes and save to write them to disk.

See the CLI Primer (part 1), CLI Primer (part 2) and CLI Primer (part 3) for more useful tips!

sudo killall -SIGHUP lighttpd
  1. Download configuration to router: curl -O http://...
  2. Switch to config mode: configure
  3. Load the config: load /config/config-old.boot
  4. Commit to apply the changes: commit
  5. Save and exist: save; exit

For reference and more information see this article.

  1. Download and add new image: add system image http://dl.ubnt.com/...
  2. Check system images: show system image
  3. Reboot system: reboot

For reference and more information see this article.