Skip to content

Instantly share code, notes, and snippets.

@pymen
pymen / advanced_logger.py
Last active April 16, 2021 17:56
AdvancedLogger
import logging
class AdvancedLogger:
"""
AdvancedLogger can be used for fine grained logging temporary modifications
How it works:
Modifications will be enabled when context_manager/decorator starts working and be reverted after
from collections import ChainMap
from copy import deepcopy
from model_utils import Choices
import string
### HELPERS STARTED
def merge_dicts(*dicts):
"""Merge multiple dicts into one
in case of intersections values from last dict will overwrite prev ones"""
@pymen
pymen / whiteboardCleaner.md
Created March 22, 2018 14:45 — forked from lelandbatey/whiteboardCleaner.md
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

Selenium with Python

Author

Baiju Muthukadan

Email

baiju.m.mail AT gmail.com

Version

0.3.2

Note

@pymen
pymen / chrome.md
Last active August 29, 2015 14:22 — forked from 0xjjpa/chrome.md

#Introduction

Developing Chrome Extensions is REALLY fun if you are a Front End engineer. If you, however, struggle with visualizing the architecture of an application, then developing a Chrome Extension is going to bite your butt multiple times due the amount of excessive components the extension works with. Here are some pointers in how to start, what problems I encounter and how to avoid them.

Note: I'm not covering chrome package apps, which although similar, work in a different way. I also won't cover the page options api neither the new brand event pages. What I explain covers most basic chrome applications and should be enough to get you started.

Table of Contents

  1. Understand the Chrome Architecture
  2. Understand the Tabs-Extension Relationship
  3. Picking the right interface for the job
#!/bin/bash
# This script will help you setup Docker for TLS authentication.
# Run it passing in the arguement for the FQDN of your docker server
#
# For example:
# ./create-docker-tls.sh myhost.docker.com
#
# The script will also create a profile.d (if it exists) entry
# which configures your docker client to use TLS
#
//oauth2 auth
chrome.identity.getAuthToken(
{'interactive': true},
function(){
//load Google's javascript client libraries
window.gapi_onload = authorize;
loadScript('https://apis.google.com/js/client.js');
}
);
@pymen
pymen / gist:d3e5f9e8116d55956cd7
Created March 4, 2015 17:12
Script to move window to opposite monitor
#!/bin/bash
#++++++++++++++++
# Monitor Switch
#
# Moves currently focused window from one monitor to the other.
# Designed for a system with two monitors.
# Script should be triggered using a keyboard shortcut.
# If the window is maximized it should remain maximized after being moved.
# If the window is not maximized it should retain its current size, unless
# height is too large for the destination monitor, when it will be trimmed.
@pymen
pymen / adblock.sh
Last active August 29, 2015 14:14 — forked from teffalump/README.md
#!/bin/sh
#Put in /etc/adblock.sh
#Block ads, malware, etc.
# Only block wireless ads? Y/N
ONLY_WIRELESS="N"
# IPv6 support? Y/N
IPV6="N"
@pymen
pymen / krusader_create_konsole
Last active January 1, 2016 16:59
Konsole and krusader quake-style start, activate of hide by one command set hotkey and have fun!
name="Krusader";
session_num=$(qdbus org.kde.konsole /Konsole newSession)
sleep 0.03
qdbus org.kde.konsole /Sessions/$session_num setTitle 0 $name
sleep 0.03
qdbus org.kde.konsole /Sessions/$session_num setTitle 1 $name
sleep 0.03
qdbus org.kde.konsole /Sessions/$session_num sendText "cd $1"
sleep 0.03