Skip to content

Instantly share code, notes, and snippets.

Avatar
🟠
MIA

Daniel Dušek dusekdan

🟠
MIA
View GitHub Profile
@dusekdan
dusekdan / README.md
Last active Feb 17, 2020
Resume Browser Work from File
View README.md

Why and What?

When I am working on something that I know I will get back to in a while and have to switch context (sometimes even a machine and an environment), I want to save all the relevant opened tabs from my browser to reopen them later. Ideally, I would like to avoid saving them to my bookmarks and rather save them together with a project (context) I was working on.

Before I wrote this small utility, I used to store the links in markdown format as a list with description of what I can find under given links. That was rather impractical and took a long time to initially write down, and also open later on.

With the utility, I can now save the links into the sources.txt file, one link per line. Then I just check-in the file together with the project into the VCS. When the time comes to start where I left of, I just run python resume.work.from.file path/to/directory/with/sources.txt/file and it opens all the tabs in my default browser.

View ips_in_net.py
def ips_in_net(ip='192.168.1.8', subnet='255.255.255.0'):
from ipaddress import ip_address, ip_network
hosts = list(ip_network(f"{ip}/{subnet}", strict=False).hosts())
return [f"{host}" for host in hosts]
@dusekdan
dusekdan / Šablona emailu pro Credit Now | České Aukce | AB Partners
Last active Aug 17, 2019
Šablona emailu k poslání na platby@credit-now.info a info@abpartners.cz
View Šablona emailu pro Credit Now | České Aukce | AB Partners
Stali jste se obětí podvodných praktik firem České Aukce popřípadě Credit Now a morálně zpochybnitelných praktik jejich
zastupující advokátní kanceláře AB Partners (Mgr. Petr Bílý, Mgr. Jan Ambrož)? Využijte tuto šablonu pro email, který
povede na ukončení celé záležitosti.
Níže naleznete šablonu emailu, který zaslat na emailové adresy:
- info@abpartners.cz
- platby@credit-now.info
Tuto šablonu, ani její části nepovažujte za právní radu. Text šablony si PŘEČTĚTE A UPRAVTE, ABY VAŠE INFORMACE SEDĚLY
@dusekdan
dusekdan / prepare_for_github.py
Last active Jun 30, 2019
Fragments files in the directory so they can be pushed into Github.
View prepare_for_github.py
# Recursively goes through the TARGET directory and zips files that are
# over SIZE_LIMIT bytes into PART_SIZE_7z parts, deleting the originals.
#
# Uses 7zip utility that needs to be ADDED INTO THE $PATH.
#
# Results in a directory structure that can be pushed into
# the GitHub without issues with oversized files.
import os, sys, subprocess
from time import sleep
@dusekdan
dusekdan / MuellerReportScaper.py
Created Apr 21, 2019
Scrapes the Mueller report from the wired's embedded article reader.
View MuellerReportScaper.py
"""
Wired Article with embeded web-reader: https://www.wired.com/story/mueller-report-russia-redacted-trump-barr-read/
How to use this script:
- Python3 & installed requests package (run: 'pip install requests')
- Create "report" folder in the same directory as this script
- run: 'python MuellerReportScraper.py'
"""
import os
import requests
@dusekdan
dusekdan / message_sender.py
Created Mar 15, 2019
Sending Messages to Game Windows Through DirectInput and Win32API
View message_sender.py
import os
import ctypes
import win32api
w = WindowMgr()
PUL = ctypes.POINTER(ctypes.c_ulong)
class KeyBdInput(ctypes.Structure):
_fields_ = [("wVk", ctypes.c_ushort),
("wScan", ctypes.c_ushort),
@dusekdan
dusekdan / window_helper.py
Created Mar 15, 2019
Snippet of python code to help working with Windows under win32gui.
View window_helper.py
import win32gui
import re
class WindowMgr:
"""Encapsulates some calls to the winapi for window management"""
def __init__ (self):
"""Constructor"""
self._handle = None
View keybase.md

Keybase proof

I hereby claim:

  • I am dusekdan on github.
  • I am dusekdan (https://keybase.io/dusekdan) on keybase.
  • I have a public key ASAl4ufteQh0y0tFaOVvsM9y-yTQYwUVC2IH2D4H2USl4go

To claim this, I am signing this object:

View test-gist-hash.js
console.log("whatever");
eval(document.domain); // oh shit
View LaravelSecurityHeadersMiddleware.php
<?php
namespace App\Http\Middleware;
use Closure;
class SecureHeaders
{
// Enumerate headers which you do not want in your application's responses.
// Great starting point would be to go check out @Scott_Helme's:
// https://securityheaders.com/
private $unwantedHeaderList = [