Skip to content

Instantly share code, notes, and snippets.


Tomislav Brabec cromat

View GitHub Profile
coltenkrauter / fix-wsl2-dns-resolution
Last active Jun 24, 2021
Fix DNS resolution in WSL2
View fix-wsl2-dns-resolution
More recent resolution:
1. cd ~/../../etc (go to etc folder in WSL).
2. echo "[network]" | sudo tee wsl.conf (Create wsl.conf file and add the first line).
3. echo "generateResolvConf = false" | sudo tee -a wsl.conf (Append wsl.conf the next line).
4. wsl --terminate Debian (Terminate WSL in Windows cmd, in case is Ubuntu not Debian).
5. cd ~/../../etc (go to etc folder in WSL).
6. sudo rm -Rf resolv.conf (Delete the resolv.conf file).
7. In windows cmd, ps or terminal with the vpn connected do: Get-NetIPInterface or ipconfig /all for get the dns primary and
cromat / Compile Redis with
Last active Nov 4, 2019 — forked from pcan/
Compile Redis with Cygwin
View Compile Redis with


Install Cygwin with make, gcc, g++ and tcl.
(If you use apt-cyg you can install them with apt-cyg install make, apt-cyg install gcc-core and apt-cyg install tcl
Download Redis tar.gz package, unpack it.


Edit deps/hiredis/net.c and add following line before include directives:

View Genymotion OVA devices
View gist:527fbc385a2e76f89609d837b6447f85
dentechy /
Last active Jun 15, 2021
A step by step tutorial on how to automatically start ssh server on boot on the Windows Subsystem for Linux

How to automatically start ssh server on boot on Windows Subsystem for Linux

Microsoft partnered with Canonical to create Bash on Ubuntu on Windows, running through a technology called the Windows Subsystem for Linux. Below are instructions on how to set up the ssh server to run automatically at boot.

  1. Edit the /etc/ssh/sshd_config file by running the command sudo vi /etc/ssh/sshd_config and do the following
    1. Change Port to 2222 (or any other port above 1000)
    2. Change PasswordAuthentication to yes. This can be changed back to no if ssh keys are setup.
  2. Restart the ssh server:
    • sudo service ssh --full-restart
  3. With this setup, the ssh server must be turned on every time you run Bash on Ubuntu on Windows, as by default it is off. Use this command to turn it on:
pcan /
Created Apr 3, 2017
Compile Redis with Cygwin


Install Cygwin with make, gcc & g++. Download Redis tar.gz package, unpack it.


Edit deps/hiredis/net.c and add the following lines just after the include directives:

notheotherben /
Last active Jan 19, 2021
Fix Postgres 9.x Sequences

PostgreSQL 9.x Sequence Fixing Script

This script is intended to automatically fix the sequence numbers for all tables in the current database.

This is accomplished through the use of the setval() command, which we provide with the next ID value we wish to make use of. We use the setval(sequence, number, is_called) overload and set is_called = false in conjunction with COALESCE(MAX + 1, 1) to ensure that, with an empty table, the next sequence value is 1 as expected.

staltz /
Last active Jun 23, 2021
The introduction to Reactive Programming you've been missing
cassus /
Last active Jun 17, 2019
Django admin action as row button
class MyAdmin(admin.ModelAdmin):
list_display = (..., 'actions_html')
def actions_html(self, obj):
return format_html('<button class="btn" type="button" onclick="activate_and_send_email({pk})">Activate and send email</button>',
actions_html.allow_tags = True
actions_html.short_description = "Actions"
View PHP: multiple constructors
the easiest way to use and multiple constructors:
class A
function __construct()
$a = func_get_args();
$i = func_num_args();
if (method_exists($this,$f='__construct'.$i)) {