Skip to content

Instantly share code, notes, and snippets.

View amotl's full-sized avatar

Andreas Motl amotl

  • $PYTHONPATH
View GitHub Profile
@dyno
dyno / plantuml_server_url_decode.py
Created December 20, 2019 08:10
plantuml server url decoder encoder
# https://plantuml.com/text-encoding
# https://github.com/dougn/python-plantuml/blob/master/plantuml.py#L64
import zlib
import base64
maketrans = bytes.maketrans
plantuml_alphabet = string.digits + string.ascii_uppercase + string.ascii_lowercase + '-_'
base64_alphabet = string.ascii_uppercase + string.ascii_lowercase + string.digits + '+/'
@comdotlinux
comdotlinux / README.md
Last active February 28, 2021 22:13
Create Github Secrets when you are not the owner and dont have access from the UI

Create Github Secrets

  • Needs python >= 3.6 (uses f strings)
  1. Create a python virtual environment
  2. python3 -m venv .venv
  3. source .venv/bin/activate
  4. Create the two files, requirements.txt and github_create_secret.py in this directory (being in this directory is not necessary but eases documentation)
  5. Install required dependencies
  6. pip install -U pip
@kas-elvirov
kas-elvirov / license-badges.md
Created March 10, 2017 06:03 — forked from lukas-h/license-badges.md
License Badges for your Project

Markdown License badges

Collection of License badges for your Project's README file. Easily copy and paste the code under the badges into your Markdown files.

Notes

  • Badges are made with Shields.io.
  • This badges do not fully replace the license informations for your projects, they are only emblems for the README, that the user can see the License at first glance.

Want to add a License?

Comment this gist or write me an E-Mail (lukas@himsel.me)

@schipiga
schipiga / uncache.py
Last active June 16, 2021 09:37
python_monkey_patch
import sys
def uncache(exclude):
"""Remove package modules from cache except excluded ones.
On next import they will be reloaded.
Args:
exclude (iter<str>): Sequence of module paths.
"""
pkgs = []
@vpnwall-services
vpnwall-services / ansible-delete-wildcard.yml
Last active January 22, 2022 20:21
[Ansible Delete Folders And Files Wildcard] Delete folders and files wildcard method with Ansible #script #yml #ansible #delete #wildcard
- hosts: all
tasks:
- name: Ansible delete file wildcard
find:
paths: /etc/wild_card/example
patterns: "^he.*.txt"
use_regex: true
register: wildcard_files_to_delete
- name: Ansible remove file wildcard
@elleryq
elleryq / jenkins-cli.sh
Created March 8, 2016 04:04
jenkins-cli.jar wrapper. Download jenkins-cli.jar automatically and wrap it as command.
#!/bin/bash
JENKINS_URL="http://localhost/jenkins"
JENKINS_JAR="/tmp/jenkins-cli.jar"
SSL_CHAR=${JENKINS_URL:4:1}
if [ ! -e $JENKINS_JAR ]; then
WGET="wget $JENKINS_URL/jnlpJars/jenkins-cli.jar -O $JENKINS_JAR"
if [ "$SSL_CHAR" == "s"]; then
/* exec-notify, so you can watch your acrobat reader or vim executing "bash -c"
* commands ;-)
* Requires some 2.6.x Linux kernel with proc connector enabled.
*
* $ cc -Wall -ansi -pedantic -std=c99 exec-notify.c
*
* (C) 2007-2010 Sebastian Krahmer <krahmer@suse.de> original netlink handling
* stolen from an proc-connector example, copyright folows:
*/
/*
@discarn8
discarn8 / DS18B20_fetch-temp.py
Last active March 25, 2022 09:51
Python script to get temperature reading from DS18B20 sensor
#!/usr/bin/python
import os
import time
if os.path.isdir('/sys/bus/w1/devices/28-011111ffffff/'):
os.system('/sbin/modprobe w1-gpio')
os.system('/sbin/modprobe w1-therm')
temp_sensor = '/sys/bus/w1/devices/28-011111ffffff/w1_slave'
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<!--
Documented at
http://linux.die.net/man/5/fonts-conf
To check font mapping run the command at terminal
$ fc-match 'helvetica Neue'
@flying-tiger
flying-tiger / vs_in_wsl.md
Last active June 15, 2022 23:08
VS Command Line Tools in WSL

Starting with the Windows 10 Creators update, Windows will append the Windows application search path to Bash's PATH variable on startup. This allows Windows applications to be called from the Linux shell like any other program (see this blog post for details).

Here's my favorite part about this: with this update, if you start Bash from within the Visual Studio Developer Command Prompt, you will have command line access to all the Visual Studio tools. This enables some neat opportunities like calling cl.exe from a makefile to build software. I prefer working on the command line and I'm not a fan of cmd.exe or Powershell, so this is a great way to leverage the native Windows toolchain from the comfort of a Linux shell.

To create a shortcut that will automatically start Bash using the VS command prompt, use the following as the shortcut target:

%comspec% /k ""C:\Program Files (x86)\M