Skip to content

Instantly share code, notes, and snippets.

View fluks's full-sized avatar

fluks fluks

View GitHub Profile
@fluks
fluks / dlive.js
Last active February 3, 2023 17:14
Open Dlive sticker to a new tab with middle mouse button
// ==UserScript==
// @name Dlive
// @description Open sticker on dlive with middle mouse button to a new tab
// @version 1
// @grant none
// @include /^https:\/\/dlive.tv\/.+$/
// @run-at document-end
// ==/UserScript==
'use strict';
@fluks
fluks / vpn_with_ufw_rules.sh
Created November 19, 2018 17:47
Open and close a VPN connection with strict firewall rules
#!/usr/bin/env bash
set -e
#set -x
# Default interface.
eth=eth0
vpn_device=tun0
vpn_port=1194
vpn_proto=udp
@fluks
fluks / remove_google_tracking_redirection.user.js
Last active November 1, 2020 19:04
Userscript for removing redirection and tracking(?) data from Google search results
// ==UserScript==
// @name Remove Google Redirect And Tracking From Search Results
// @description Userscript for removing redirection and tracking(?) data from Google search results.
// @version 1
// @author fluks
// @include https://*.google.*/search?*
// ==/UserScript==
document.querySelectorAll('h3.r > a')
.forEach(e => {
@fluks
fluks / gdbgui.pug
Created August 12, 2017 17:30
Add doctype and fix indentation in gdbgui.pug
//- This is .pug file, which generates html. It used to be name jade.
//- Try instant online conversion at http://www.html2jade.org/
doctype html
html
head
title gdbgui - gdb in a browser
base(target='_blank')
@fluks
fluks / src_libmhe_xmalloc.c
Created October 8, 2015 02:22
xrealloc modification
void* new_ptr = realloc(ptr, size);
- if (!new_ptr) {
- // If size is zero, free() was called, instead of realloc(). Don't use after free().
- if (size != 0) {
- fprintf(stderr, "\nxrealloc(%p, %zu): %s\n", ptr, size, strerror(errno));
- free(ptr);
- }
+ // If size is zero, realloc() is equivalent to free().
+ if (!new_ptr && size != 0) {
+ fprintf(stderr, "\nxrealloc(%p, %zu): %s\n", ptr, size, strerror(errno));