Skip to content

Instantly share code, notes, and snippets.

View dmerejkowsky's full-sized avatar
🍵
418 - I'm a teapot

Dimitri Merejkowsky dmerejkowsky

🍵
418 - I'm a teapot
View GitHub Profile
@dmerejkowsky
dmerejkowsky / dotclear-to-hugo.py
Created August 18, 2017 08:39
dotclear to hugo
+import sqlite3
+import re
+import arrow
+
+connection = sqlite3.connect("/home/dmerej/backups/dmerej.info/blog/db/blog-2016-05-21.sqlite")
+
+cursor = connection.cursor()
+
+def slugify(text):
+ res = re.sub('[^\w\s-]', '', text).strip().lower()
@dmerejkowsky
dmerejkowsky / crash.txt
Last active May 3, 2017 16:07
git-repo crash
$ git repo config
Do you want to configure the bitbucket service?
[Yn]> n
Do you want to configure the gitbucket service?
[Yn]> n
Do you want to configure the github service?
[Yn]> y
Is your service self-hosted?
[yN]> n
Please enter your credentials to connect to the service:
@dmerejkowsky
dmerejkowsky / gist:bed3d5a1d9f30706d69e81395c5a00ed
Created April 6, 2017 13:42
Weird linker crash with visual studio
Version 14.00.24215.1
ExceptionCode = C0000005
ExceptionFlags = 00000000
ExceptionAddress = 00007FF7CD1A3157 (00007FF7CD180000) "C:\PROGRA~2\MICROS~1.0\VC\bin\AMD64_~2\link.exe"
NumberParameters = 00000002
ExceptionInformation[ 0] = 0000000000000000
ExceptionInformation[ 1] = 00000002007F1600
CONTEXT:
@dmerejkowsky
dmerejkowsky / gist:695a35df4ea420613936fd2608121094
Created April 6, 2017 13:42
Weird linker crash with visual studio
Version 14.00.24215.1
ExceptionCode = C0000005
ExceptionFlags = 00000000
ExceptionAddress = 00007FF7CD1A3157 (00007FF7CD180000) "C:\PROGRA~2\MICROS~1.0\VC\bin\AMD64_~2\link.exe"
NumberParameters = 00000002
ExceptionInformation[ 0] = 0000000000000000
ExceptionInformation[ 1] = 00000002007F1600
CONTEXT:
@dmerejkowsky
dmerejkowsky / run-mccabe.py
Created March 25, 2017 17:26
Running mccabe
""" Tiny wrapper for mccabe module.
Iterate over all the python sources, and print results in
an easily parseable format
If you are already using pyflakes or prospector, you won't need this :)
Dependencies: mmcabe, path.py
"""
@dmerejkowsky
dmerejkowsky / simple-display-manager.sh
Created January 3, 2017 21:25
Dead simple display manager
# in ~/.profile
case "$(tty)" in
"/dev/tty1") exec startx;;
"/dev/tty2") exec startx /usr/bin/bspwm;;
"/dev/tty3") exec startx /usr/bin/kodi;;
"/dev/tty4") exec startx /usr/games/steam -bigpicture;;
esac
# source: Arch Linux forums: https://bbs.archlinux.org/viewtopic.php?pid=1680406#p1680406
@dmerejkowsky
dmerejkowsky / test_netrc.py
Created October 19, 2016 19:01
testing netrc.py when HOME is not set
class NetrcTestCase(unittest.TestCase):
...
def test_no_home_in_env(self):
# This one in tough.
# We need this test to pass even if ~/.netrc does not exist. So we need a mock.
#
# * The mock itself needs a handle that will be returned when calling
@dmerejkowsky
dmerejkowsky / ninja-test-idea.md
Created September 12, 2016 18:54
Only run modified tests with ninja

Seen on ninja development mailing list (thanks, Evan Martin)

For each test, add a build rule like:

build test1.stamp: test1.exe
  cmd = $in && touch $out

And then one to gather them:

@dmerejkowsky
dmerejkowsky / neovim-release-stats.txt
Created September 7, 2016 20:34
Neovim's release stats
version files insertions deletions
--------- ------- ------------ -----------
v0.1.1 264 8875 7616
v0.1.2 294 13132 7499
v0.1.3 174 8012 4529
v0.1.4 180 11042 4869
v0.1.5 676 36182 19516
master 159 3862 2299
set "PATH=%PATH%;C:\Program Files\CMake\bin"
set "PATH=%PATH%;C:\Ninja"
"C:\Program Files (x86)\Microsoft Visual C++ Build Tools\vcbuildtools.bat"
cd c:\Users\username
rem Save in C:\Users\username\sourceme.bat and just type sourceme after running cmd.exe
rem (sadly, the last 'cd' does not work)