Skip to content

Instantly share code, notes, and snippets.

View dusekdan's full-sized avatar
🟠
MIA

Daniel Dusek dusekdan

🟠
MIA
View GitHub Profile
@dusekdan
dusekdan / window_helper.py
Created March 15, 2019 16:59
Snippet of python code to help working with Windows under win32gui.
import win32gui
import re
class WindowMgr:
"""Encapsulates some calls to the winapi for window management"""
def __init__ (self):
"""Constructor"""
self._handle = None

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:

console.log("whatever");
eval(document.domain); // oh shit
<?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 = [
<?php
header('X-XSS-Protection: 1; mode=block');
header('X-Content-Type: nosniff');
header('X-Frame-Options: DENY');
// If you have sensitive information in any of your URLS, use 'no-referrer' as a value instead)
header('Referrer-Policy: no-referrer-when-downgrade');
?>
import sys
import os
import datetime
from shutil import copy
# By far the easiest way to get song duration is to use mutagen library. You
# can install it using PIP as follows:
# pip install mutagen
from mutagen.mp3 import MP3
from mutagen import MutagenError

Vypracování otázek z první přednášky

2.01: Sebereflexe a sebeřízení

2.01.1 Peníze:

  • A. Nefungují jako motivace, pouze jako faktor hygieny, tedy stimulace.
  • B. Jsou stimulantem, protože nemohou vyvolat pocit motivace.
  • C. Mohou motivovat i stimulovat, byť je schopnost motivace omezena.
  • D. Fungují jako nejsilnější faktor motivace i stimulace zároveň.

2.01.2 Ke které behaviorální kompetenci se vztahuje následující chování: "Kritika ho uráží anebo pobuřuje, na útoky reaguje agresivně, často reaguje emocionálně a nekontroluje se. Vůči ostatním je zaujatý.":

# Spotify fix
127.0.0.1 media-match.com
127.0.0.1 adclick.g.doublecklick.net
127.0.0.1 www.googleadservices.com
127.0.0.1 pagead2.googlesyndication.com
127.0.0.1 desktop.spotify.com
127.0.0.1 googleads.g.doubleclick.net
127.0.0.1 audio2.spotify.com
127.0.0.1 www.omaze.com
127.0.0.1 omaze.com
SHELL := /bin/bash
# Retrieves todo items from LaTeX file and prints them (+ their count)
define get_todo_items
@allTodoItems=$$(grep -i '% todo' xdusek21.tex | wc -l); echo -e "\n\e[33mFound \e[91m$$allTodoItems \e[33mTODO items:\n"
@grep -i '% todo' xdusek21.tex | while read -r line ; do echo -e "\t \e[92m$$line\n" ; done ; echo -e "\e[39m"
endef
all:
@dusekdan
dusekdan / 99 Haskell Problems with explanation.hs
Last active June 2, 2017 18:54
99 Haskell Problems (https://wiki.haskell.org/99_questions) as solved and explained by Daniel Dušek
-- #1
-- Find the last element of a list
-- Explanation:
-- Last element of one-element list is the element
-- General list last element is discovered by recursively calling myLast over
-- the tail of the list (xs). Once case myLast [x] is hit, we got our last
-- element.
myLast :: [a] -> a
myLast [x] = x
myLast (x:xs) = myLast(xs)