Skip to content

Instantly share code, notes, and snippets.

View sjagoe's full-sized avatar
🏍️

Simon Jagoe sjagoe

🏍️
  • Helsinki, FInland
View GitHub Profile
@sjagoe
sjagoe / pre-push
Created June 13, 2023 15:22
git global pre-push hook to prevent accidental push to main branch
#!/bin/bash
RED="\033[31m";
RESET="\033[0m";
BOLD="\033[1m";
ppid_is_emacs() {
local command=
command="$(ps ho comm "$1")"
[[ "$command" =~ .*emacs.* ]]
# This is a blocklist to block samsung smart tv's sending meta data at home.
# Please help to collect domains!
# It could be that the TV does not receive any more updates or other services no longer work. Please report such an incident.
abtauthprd.samsungcloudsolution.com
acr0.samsungcloudsolution.com
ad.samsungadhub.com
ads.samsungads.com
amauthprd.samsungcloudsolution.com
api-hub.samsungyosemite.com
@sjagoe
sjagoe / sds_scdp.py
Created February 4, 2019 10:39 — forked from mobilinkd/sds_scdp.py
Screendump From Siglent DSO via VXI-11
#!/usr/bin/env python
import argparse
import visa, sys
from pyvisa.constants import StatusCode
from PIL import Image
from cStringIO import StringIO
def screendump(device, filename):
2018-05-29 13:57:13,687 DEBUG [google.cloud.pubsub_v1.subscriber._protocol.dispatcher:59] Started helper thread Thread-CallbackRequestDispatcher
2018-05-29 13:57:13,687 DEBUG [google.cloud.pubsub_v1.subscriber._protocol.bidi:484] Started helper thread Thread-ConsumeBidirectionalStream
2018-05-29 13:57:13,688 DEBUG [google.cloud.pubsub_v1.subscriber._protocol.leaser:108] The current p99 value is 10 seconds.
2018-05-29 13:57:13,689 DEBUG [google.cloud.pubsub_v1.subscriber._protocol.leaser:161] Snoozing lease management for 4.632272 seconds.
2018-05-29 13:57:13,689 DEBUG [google.cloud.pubsub_v1.subscriber._protocol.leaser:178] Started helper thread Thread-LeaseMaintainer
2018-05-29 13:57:13,690 DEBUG [google.cloud.pubsub_v1.subscriber._protocol.bidi:456] waiting for recv.
2018-05-29 13:57:13,793 DEBUG [google.auth.transport.requests:117] Making request: POST https://accounts.google.com/o/oauth2/token
2018-05-29 13:57:13,796 DEBUG [urllib3.connectionpool:824] Starting new HTTPS connection
@sjagoe
sjagoe / randomize-mac-addresses
Created December 3, 2017 16:21 — forked from fawkesley/randomize-mac-addresses.sh
In Ubuntu 16.04, randomize WiFi MAC addresses with a daily rotation - /etc/NetworkManager/dispatcher.d/pre-up.d/randomize-mac-addresses
#!/bin/sh
# /etc/NetworkManager/dispatcher.d/pre-up.d/randomize-mac-addresses
# Configure every saved WiFi connection in NetworkManager with a spoofed MAC
# address, seeded from the UUID of the connection and the date eg:
# 'c31bbcc4-d6ad-11e7-9a5a-e7e1491a7e20-2017-11-20'
# This makes your MAC impossible(?) to track across WiFi providers, and
# for one provider to track across days.
@sjagoe
sjagoe / vimium-emacs.md
Created November 17, 2017 08:03 — forked from dmgerman/vimium-emacs.md
Emacs-Style Key Bindings for Vimium

My Vimium Key Bindings (Emacs-Style)

This is a full set of key bindings (as of Vimium v1.45); covering all Vimium functionality. I have tried to map all Vimium functionality to comparable Emacs functionality (whenever possible). In cases where there is no equivalent, those commands are prefixed by <c-g> (indicating <c-g>oogle Chrome; and because <c-g> does not conflict with other Emacs shortcuts at all).

Commented Shortcuts: There are a few Emacs-style shortcuts that are simply not possible in Vimium. All of my shortcuts (including those which were not possible; i.e. where I used a decent alternative) have been commented below. This should help to clarify my rationale.

_Compatibility: All of these shortcuts were tested on Mac OS X (Mavericks). Please note that all of my shortcuts operate under the assumption that your Emacs Meta key is the Alt/Option key. This really was my only choice, because the key is already used in Chrome for shortcuts that c

@sjagoe
sjagoe / vimium.conf
Created November 17, 2017 08:02 — forked from avendael/vimium.conf
Emacs keybindings for vimium. Paste this into vimium's advanced settings.
map <c-n> scrollDown
map <c-p> scrollUp
map <c-b> scrollLeft
map <c-f> scrollFullPageDown
map <c-b> scrollFullPageUp
map <c-v> scrollFullPageDown
map <a-v> scrollFullPageUp
map <c-w> copyCurrentUrl
map <a-w> copyCurrentUrl
map <c-k> copyCurrentUrl
@sjagoe
sjagoe / socat-example.sh
Last active August 29, 2015 14:25
Socat example
ubuntu@ip-172-20-30-106:~$ sudo apt-get install socat curl
....
ubuntu@ip-172-20-30-106:~$ socat TCP-LISTEN:8888,fork OPENSSL:google.com:443,cafile=/etc/ssl/certs/ca-certificates.crt,verify=1 &
[1] 27060
ubuntu@ip-172-20-30-106:~$ curl -H 'Host: google.com' localhost:8888
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="https://www.google.com/">here</A>.
@sjagoe
sjagoe / .nixpkgs-config.nix
Last active August 29, 2015 14:16
common-shell
{
allowUnfree = true;
packageOverrides = pkgs: with pkgs; {
pythonDevEnv = stdenv.mkDerivation {
name = "basic-python-env";
buildInputs = [
openssh
git
stdenv
{
packageOverrides = pkgs: rec {
ansible = pkgs.stdenv.lib.overrideDerivation pkgs.ansible (attrs: {
version = "1.8.4";
name = "ansible-1.8.4";
src = pkgs.fetchurl {
url = "http://releases.ansible.com/ansible/ansible-1.8.4.tar.gz";
sha256 = "1hcy4f6l9c23aa05yi4mr0zbqp0c6v5zq4c3dim076yfmfrh8z6k";
};
});