Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View rayluo's full-sized avatar
🎯
Focusing

Ray Luo rayluo

🎯
Focusing
View GitHub Profile
@bgavrilMS
bgavrilMS / clone_gh_issue.ps1
Last active January 17, 2024 20:03
Clone GitHub issue cross MSAL repos
# 1. One time setup: install GH CLI https://cli.github.com/
# 2. Update $issue_to_clone and $target_repos variables
# 3. Manually update the project if needed (e.g. Customer Trust). Labels should be automatically cloned.
# Config - step 1
$issue_to_clone = "https://github.com/AzureAD/microsoft-authentication-library-for-java/issues/757"
$repo_java = 'https://github.com/AzureAD/microsoft-authentication-library-for-java/'
$repo_go = 'https://github.com/AzureAD/microsoft-authentication-library-for-go/'
$repo_py = 'https://github.com/AzureAD/microsoft-authentication-library-for-python/'
@j-c-cook
j-c-cook / cross-compile-python.md
Last active April 9, 2024 17:09
Cross-compile Python for use on armv7l

Cross-compile Python for use on armv7l

Introduction

This post shows how to cross compile Python (using the [CPython][#cpython] implementation) for use on an armv7l chip. This can likely be extrapolated to other chip archetectures, but the proper cross-compilation toolchain would need to be substituded. The Python version utilized here is version 3.7.13. The driving force behind this effort was to get [python-can][#python-can] functional on an armv7l platform. This compilation process is done on a Ubuntu 20.04.4 LTS operating system. I have utilized various online references and will do my best to provide citation and links.

In my case the device with an armv7l chip contains a root file system and shared objects that are compiled using a version of [buildroot][#buildroot]. The buildroot menu configuration allows for the selection of Python 3 for installation, but not all of the basic packages are included. For example, importing the python-can package into an environment using Python 3 installed b

@demaniak
demaniak / Dockerfile
Created April 24, 2020 06:55
Run Microsoft teams in docker on linux
FROM ubuntu
RUN apt-get update && \
apt-get install -y curl apt-utils \
libasound2 libatk-bridge2.0-0 libcairo2 libcups2 libgdk-pixbuf2.0-0 \
libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 \
libsecret-1-0 libx11-xcb1 libxcomposite1 libxcomposite1 \
libxss1 apt-transport-https libxkbfile1
COPY teams.deb /tmp/teams.deb
@eli9000
eli9000 / bookworm.md
Last active April 20, 2024 04:06
Change your Raspberry Pi scrolling to Natural Scrolling - NEW Bookworm hack!

Bookworm OS (Debian 12)

While this method is indeed a bit hacky, it does work! Perhaps in due course wayfire will make this a bit more straight forward...

🚨 🚨 For some reason wayfire will (occasionally) add back in the <min>0.0</min> line and will also remove the <max>1.0</max> (see Step 2. If you notice natural scroll not working, this is most likely the cause. Just repeat this step and sudo reboot... hey I said it was hacky 🤷🏻‍♂️

Step 1

vi ~/.config/wayfire.ini
@althonos
althonos / setup.cfg
Last active March 4, 2024 18:08
A `setup.cfg` template for my Python projects
# https://gist.github.com/althonos/6914b896789d3f2078d1e6237642c35c
[metadata]
name = {name}
version = file: {name}/_version.txt
author = Martin Larralde
author_email = martin.larralde@embl.de
url = https://github.com/althonos/{name}
description = {description}
long_description = file: README.md
@gene1wood
gene1wood / analyze_pypi_package_names.py
Last active June 12, 2023 02:24
Analysis of PyPi package names and the use of dashes underscores upper and lower case
try:
import xmlrpclib
except ImportError:
import xmlrpc.client as xmlrpclib
client = xmlrpclib.ServerProxy('https://pypi.python.org/pypi')
packages = client.list_packages()
total = len(packages)
dashes = len([x for x in packages if '-' in x])
@diewland
diewland / n10_hdmi_resolution.txt
Created June 16, 2016 04:44
Nexus 10 change resolution script for fix hdmi problem
# ----------------
# http://forum.xda-developers.com/showthread.php?t=2278508
# http://forum.xda-developers.com/showthread.php?t=2294786
#
# (require root)
# reset
wm size reset
wm density reset
wm overscan reset
@erikbern
erikbern / use_pfx_with_requests.py
Last active April 3, 2024 07:53
How to use a .pfx file with Python requests – also works with .p12 files
import contextlib
import OpenSSL.crypto
import os
import requests
import ssl
import tempfile
@contextlib.contextmanager
def pfx_to_pem(pfx_path, pfx_password):
''' Decrypts the .pfx file to be used with requests. '''
@jpf
jpf / signed-jwt-in-python.md
Last active February 17, 2024 15:07
JWTs signed with RS256 in Python: A demonstration of org-babel

Introduction

This is a guide to using pyjwt to sign and validate a JWT using RS256.

The trickiest part of doing this is knowing what the proper OpenSSL commands are to generate the RSA keypair. I demonstrate that below.

Generating RSA keys

@iMilnb
iMilnb / boto3_hands_on.md
Last active October 19, 2022 09:15
Programmatically manipulate AWS resources with boto3 - a quick hands on

boto3 quick hands-on

This documentation aims at being a quick-straight-to-the-point-hands-on AWS resources manipulation with [boto3][0].

First of all, you'll need to install [boto3][0]. Installing it along with [awscli][1] is probably a good idea as

  • [awscli][1] is boto-based
  • [awscli][1] usage is really close to boto's