Skip to content

Instantly share code, notes, and snippets.

View MarrekNozka's full-sized avatar
🤔

Marrek Nožka MarrekNozka

🤔
View GitHub Profile
@MarrekNozka
MarrekNozka / xterm-bg.sh
Created January 12, 2024 11:43 — forked from blueyed/xterm-bg.sh
Query background setting from terminal (xterm / rxvt-unicode)
#!/bin/sh
#
# Query a property from the terminal, e.g. background color.
#
# XTerm Operating System Commands
# "ESC ] Ps;Pt ST"
oldstty=$(stty -g)
# What to query?
@MarrekNozka
MarrekNozka / example.html.j2
Last active October 23, 2020 18:15 — forked from doobeh/example.html
Checkbox WTForms Example (in Flask)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<form method="post">
{{ form.hidden_tag() }}
{% for e in form.example %}
@MarrekNozka
MarrekNozka / print256colours.sh
Created January 20, 2020 17:48 — forked from HaleTom/print256colours.sh
Print a 256-colour test pattern in the terminal
#!/bin/bash
# Tom Hale, 2016. MIT Licence.
# Print out 256 colours, with each number printed in its corresponding colour
# See http://askubuntu.com/questions/821157/print-a-256-color-test-pattern-in-the-terminal/821163#821163
set -eu # Fail on errors or undeclared variables
printable_colours=256
#!/usr/bin/env python
import pynvim, os, re, sys, time
# Get a list of buffers that haven't been deleted. `nvim.buffers` includes
# buffers that have had `:bdelete` called on them and aren't in the buffer
# list, so we have to filter those out.
def get_listed_buffers(nvim):
return set(buf.number for buf in nvim.buffers \
if nvim.eval('buflisted(%d)' % buf.number))
" Open URL in browser
function! Browser ()
let line = getline (".")
let line = matchstr (line, "http[^ ]*")
exec "!chromium ".line
endfunction
@MarrekNozka
MarrekNozka / h264-vivaldi-linux.md
Created October 7, 2018 15:47 — forked from ruario/h264-vivaldi-linux.md
How to enable HTML5 MP4 (H.264/AAC) video in Vivaldi for Linux, via an alternative FFMpeg library

How to enable HTML5 MP4 (H.264/AAC) video in Vivaldi for Linux, via an alternative FFMpeg library

Intro

The following is a quick guide to get this working on various Linux distros. As a side note, if you have Chrome installed alongside Vivaldi, Netflix should also work after making these changes. Alternatively, use my latest-widevine.sh to fetch and extract Chrome's copy of Widevine, so that it can be used by Vivaldi.

If you don't have working Flash video and need that in addition, please refer to these instructions.

Note: This guide is primarily aimed at users of Vivaldi stable releases. If it does not solve your issues, read this in addition.

@MarrekNozka
MarrekNozka / intro-latest-widevine.md
Created October 7, 2018 15:41 — forked from ruario/intro-latest-widevine.md
Fetches the latest Linux Widevine binary so that it can be used by Vivaldi.

Summary

A bunch of people asked how they could use this script with pure Chromium on Ubuntu. The following is a quick guide. Though I still suggest you at least try Vivaldi. Who knows, you might like it. Worried about proprietary componants? Remember that libwidevinecdm.so is a binary blob you are taking from Chrome, so by following this guide you will have already made your distro less "pure". Also all our additions to the Chromium base are open source and our UI, while not open, is written in HTML/CSS/JS. Thus you can see exactly what we are doing (no funny business).

If you still want to run Chromium, the following explains how it is done.

Note: For ARM(hf) use this instead. Beware it requires a +2Gb download of a ChromeOS recovery image. You can actually run it on a “regular” (x86 or x86_64 Linux) PC as it will create an archive file that can be copied to the target machine.

Chromium setup

@MarrekNozka
MarrekNozka / sorts.py
Last active August 29, 2015 14:20 — forked from mrazekthom/sorts.py
import time
import random
def select_sort(array):
for i in range(0, len(array)):
min = i
for j in range(i+1, len(array)):
if array[min] > array[j]:
min = j
if i != min:
import socket
if __name__ == "__main__":
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(("localhost", 9000))
data = "some data"
sock.sendall(data)
result = sock.recv(1024)
print result
sock.close()
def accept_languages(browser_pref_langs):
"""Parses the request and return language list.
browser_pref_langs is the plain Accept-Language http request header
value.
Stolen from Products.PloneLanguageTool, under GPL (c) Plone Foundation,
slightly modified.
Taken from tweetengine http://github.com/Arachnid/tweetengine/
"""
browser_pref_langs = browser_pref_langs.split(',')
i = 0