Skip to content

Instantly share code, notes, and snippets.

View krid78's full-sized avatar

Daniel Kriesten krid78

View GitHub Profile
@krid78
krid78 / analyze_pptx.py
Created September 16, 2023 14:43
Analyze pptx using python-pptx
__SRC_PATH__ = "foo/"
__SRC_NAME__ = "bar.pptx"
def main():
"""The main function"""
prs = Presentation(f"{__SRC_PATH__}{__SRC_NAME__}")
for sl_idx,slide in enumerate(prs.slides):
print(f"--- Slide {sl_idx} --- slide_layouts[{prs.slide_layouts.index(slide.slide_layout)}]: \"{slide.slide_layout.name}\"")
print(f"--- Slide {sl_idx} --- Placeholders ---")
for ph_idx,ph in enumerate(slide.placeholders):
@krid78
krid78 / type_set.py
Created May 4, 2016 06:41
return correct type for value in python
def type_set(val):
"""
return the value with its correct type
default type of return value is str
:val: input value of any type
:return: same value, correct type
"""
try:
return int(val)
except ValueError:
@krid78
krid78 / iterm2-terminal-commands-in-current-shell.scpt
Created February 21, 2016 07:48
Alfred iTerm2 (version 2) for '>'
-- http://www.alfredforum.com/topic/721-executing-iterm2-terminal-commands-in-current-shell/
on alfred_script(q)
tell application "iTerm"
activate
try -- We don't need error messages
set miniaturized of windows to false
end try
try
@krid78
krid78 / AllWindowsToScreen
Created January 30, 2013 13:04
This Script places All windows within the screen bounds
-- Found at: http://hints.macworld.com/article.php?story=2007102012424539
-- Example list of processes to ignore: {"xGestures"} or {"xGestures", "OtherApp", ...}
property processesToIgnore : {"loginwindow", "talagent", "Dock", "SystemUIServer", "SIMBL Agent", "AFSBackgrounder", "NotificationCenter", "iTunesHelper", "PhotoStreamAgent", "com.apple.dock.extra", "WebProcess", "AppleSpell", "com.apple.qtkitserver", "SophosUIServer", "PTPCamera", "Image Capture Extension", "mdworker", "System Events"}
-- Get the size of the Display(s), only useful if there is one display
-- otherwise it will grab the total size of both displays
tell application "Finder"
set _b to bounds of window of desktop
set screen_width to item 3 of _b
@krid78
krid78 / .xsession
Created October 20, 2012 07:01
Gentoo ~/.xsession
#!/usr/bin/env bash
echo "*** $0: $(date) @ ${HOSTNAME}" >> ${HOME}/sessionlog.txt
xset b 100 400 20 # set bell style volume(%) pitch duration
xset c off # keyclick off
xset m 35/10 10 # mouse
xterm -name ${HOSTNAME} -geometry 90x26+0+0&
@krid78
krid78 / .xinitrc
Created October 20, 2012 06:58
Gentoo ~/.xinitrc
#!/usr/bin/env bash
echo "*** $0: $(date) @ ${HOSTNAME}" >> ${HOME}/sessionlog.txt
xset b 100 400 20 # set bell style volume(%) pitch duration
xset c off # keyclick off
xset m 35/10 10 # mouse
#TODO: check for remote session!
xrandr --verbose --query --output VGA1 --auto 2>&1 >> ${HOME}/sessionlog.txt