Skip to content

Instantly share code, notes, and snippets.

View lukpueh's full-sized avatar

Lukas Pühringer lukpueh

View GitHub Profile
@lukpueh
lukpueh / trac2down.py
Created May 6, 2016 16:48 — forked from sgk/trac2down.py
Trac Wiki to Markdown converter
#!/usr/bin/python
# vim:set fileencoding=utf-8 sw=2 ai:
import sqlite3
import datetime
import re
SQL = '''
select
name, version, time, author, text
@lukpueh
lukpueh / say_lte.py
Created May 24, 2018 10:38
Script to help me position my `Alcatel Linkhub HH40v` LTE modem for the best signal strength
#!/usr/bin/env python
"""
<Program Name>
say_lte.py
<Author>
Lukas Puehringer <luk.puehringer@gmail.com>
<Purpose>
Script to help me position my `Alcatel Linkhub HH40v` LTE modem for the
@lukpueh
lukpueh / count_html_elems.py
Created May 28, 2018 10:14
Basic HTML tag opening-closing-pair validator
#!/usr/bin/env python
"""
<Program Name>
count_html_elems.py
<Author>
Lukas Puehringer <luk.puehringer@gmail.com>
<Started>
May, 2018
@lukpueh
lukpueh / find_in_pdf.py
Created August 16, 2018 10:18
Sublime Text 3 command to find next or previous occurrence of a string in a tex document and in the corresponding open pdf document
"""
Sublime Text 3 command to find next or previous occurrence of a string in a tex
document and in the corresponding open pdf document, built with ST3 package
`LaTeXTools`, and displayed using OSX pdf viewer `skim`.
Add snippet to new *.py file in:
~/Library/Application\ Support/Sublime\ Text\ 3/Packages/User/
Handy keybindings:
(~/Library/Application Support/Sublime Text 3/Packages/User/Default (OSX).sublime-keymap
@lukpueh
lukpueh / lind_webhook_listener.py
Created October 29, 2018 15:36
Flask app to listen for a GitHub push webhook request on one repo and trigger a Travis build on another repo.
"""
Tiny flask app that listens for incoming requests from a "GitHub webhook",
and, if the webhook was triggered by a push to the "native_client" repo,
calls the "Travis API" to trigger a build for the "lind_project" repo.
"""
import os
import json
import hmac
import hashlib
import requests
@lukpueh
lukpueh / recursive_nested_to_upper.go
Created April 10, 2019 11:29
Self-educational go snippet to learn about the empty interface{} type.
// Self-educational go snippet to learn about the empty interface{} type.
// Based on @hvoecking's arbitrary structures traversal gist
// https://gist.github.com/hvoecking/10772475
package main
import (
"fmt"
"reflect"
@lukpueh
lukpueh / profile_tuf_bins.py
Last active March 19, 2020 17:51
Script to generate and write a basic TUF repo for profiling purposes
"""
Script to generate and write a basic TUF repo with keys, top-level roles, a
delegated targets role, and BIN_N_COUNT delegated targets roles, for profiling
purposes.
<Usage>
pip install securesystemslib[crypto,pynacl] tuf
curl https://gist.githubusercontent.com/lukpueh/724bd1d7b477f201a9f199b037d85747/raw/profile_tuf_bins.py -o profile_tuf_bins.py
python -m cProfile -o stats profile_tuf_bins.py
@lukpueh
lukpueh / tuf_with_unicode.py
Created March 20, 2020 14:46
Minimal tuf repo <-> client unicode example
# coding: utf-8
"""Minimal tuf repo <-> client example, with unicode
- delegated targets role name, and
- target file name
"""
import os, tempfile, shutil, six
from tuf.repository_tool import *
from securesystemslib.process import subprocess, run_duplicate_streams
@lukpueh
lukpueh / gh_org_info.py
Last active January 14, 2021 14:50
Query GitHub REST API to get org permission for people and teams.
#!/usr/bin/env python
"""Query GitHub REST API to get org permission for people and teams
Usage:
./gh_org_info.py <GitHub user name> <AuthToken> <organization name>
Note: To create an authentication token see
https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token
Result:
{
"people": {
@lukpueh
lukpueh / scrape_box.py
Created March 23, 2022 13:45
Scrape app.box.com pseudo PDFs
import os
import base64
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
TIMEOUT = 10000