Skip to content

Instantly share code, notes, and snippets.

@jonasjancarik
jonasjancarik / clickEvents.js
Created June 18, 2018 14:02
Gephi SVG interactivity
// Gephi SVG visualisation interactivity
$('.viz-view svg').click(function (event) {
// check if the click was on one of the SVG child elements
if (event.target !== this) {
// set the clicked element as the target (because 'this' is the parent SVG element)
var target = $(event.target);
// if the click is on an edge path
// ==UserScript==
// @name Medium - Hide Featured
// @namespace http://tampermonkey.net/
// @version 0.3
// @description try to take over the world!
// @author You
// @match https://medium.com/*
// @grant none
// ==/UserScript==
@jonasjancarik
jonasjancarik / one-liners.md
Last active January 10, 2020 07:02
Bash/cmd/PS one-liners and other helpful stuff

Add BOM to CSV files (to open UTF-8 CSVs correctly in Excel):

sed -i '1s/^\(\xef\xbb\xbf\)\?/\xef\xbb\xbf/' *.csv

To check if a file contains UTF-8 BOM at header:

# hexdump -n 3 -C 2.txt
00000000 ef bb bf
@jonasjancarik
jonasjancarik / dvtv-playback-speed-userscript.js
Last active December 16, 2019 15:18
DVTV Playback Speed Controls (userscript)
// ==UserScript==
// @name DVTV Playback Speed Controls
// @namespace http://tampermonkey.net/
// @version 0.3
// @description Adds playback speed controls to the DVTV video player
// @author You
// @match https://video.aktualne.cz/dvtv/*
// @grant none
// ==/UserScript==
(koronavirus OR koronaviru OR koronavirusu OR koronavire OR koronaviruse OR koronavirem OR koronavirusem OR covid OR covidu OR covide OR covidem OR covid-19 OR covidový OR covidového OR covidovému OR covidovém OR covidovým OR covidová OR covidové OR covidovou OR covidoví OR covidových OR covidovými OR koronavirový OR koronavirového OR koronavirovému OR koronavirovém OR koronavirovým OR koronavirová OR koronavirové OR koronavirovou OR koronaviroví OR koronavirových OR koronavirovými)
AND
(vakcína OR vakcíny OR vakcíně OR vakcínu OR vakcíno OR vakcínou OR vakcín OR vakcínám OR vakcínách OR vakcínami OR očkování OR očkováním OR očkováních OR očkováními OR očkovací)
@jonasjancarik
jonasjancarik / stream.py
Last active March 22, 2022 14:10
Tweepy 4+ Streaming Example
import tweepy
from dotenv import load_dotenv
import os
load_dotenv()
class Listener(tweepy.Stream):
def __init__(self, *args, **kwargs):
super(Listener, self).__init__(*args)
echo "Writing a script to toggle the settings (~/toggle_dns.sh)..."
if echo "#!/bin/bash
if grep -Fxq \"dns=none\" /etc/NetworkManager/NetworkManager.conf
then
echo \"[main]
plugins=ifupdown,keyfile
[ifupdown]
managed=false\" > /etc/NetworkManager/NetworkManager.conf
@jonasjancarik
jonasjancarik / change_tor_country.desktop
Last active January 19, 2023 12:58
Bash script to set the exit node country for the Tor Browser
[Desktop Entry]
Type=Application
Name=Change Tor Country
Exec=sh -c "~/Desktop/Browser/change_tor_country.sh"
Icon=gnome-globe-net
Terminal=true
@jonasjancarik
jonasjancarik / install.sh
Last active February 9, 2023 12:38
ProtonVPN from Terminal - use a random config file
echo -e "\n\nDownloading custom ProtonVPN scripts...\n\n"
curl -s -o ~/protonvpn.sh "https://gist.githubusercontent.com/jonasjancarik/d5b73a1c1274defd290304db1cb0dfaf/raw/protonvpn.sh?$RANDOM"
chmod +x ~/protonvpn.sh
curl -s -o ~/Desktop/protonvpn_script.desktop "https://gist.githubusercontent.com/jonasjancarik/d5b73a1c1274defd290304db1cb0dfaf/raw/protonvpn_script.desktop?$RANDOM"
chmod 755 ~/Desktop/protonvpn_script.desktop
gio set ~/Desktop/protonvpn_script.desktop metadata::trusted true
curl -s -o ~/Desktop/protonvpn_disconnect.desktop "https://gist.githubusercontent.com/jonasjancarik/d5b73a1c1274defd290304db1cb0dfaf/raw/protonvpn_disconnect.desktop?$RANDOM"
chmod 755 ~/Desktop/protonvpn_disconnect.desktop
gio set ~/Desktop/protonvpn_disconnect.desktop metadata::trusted true
echo -e "\n\n\e[32m$(tput bold)The script is now installed.$(tput sgr0)\e[0m \nUse the \"ProtonVPN (Free)\" shortcut on the desktop to launch it.\n\n"
@jonasjancarik
jonasjancarik / install_protonvpn.sh
Last active April 5, 2023 12:28
Install proton-vpn linux-cli-community (Ubuntu)
#!/bin/bash
set -e
# colors
RED="\e[31m"
GREEN="\e[32m"
YELLOW="\e[33m"
ENDCOLOR="\e[0m"