Skip to content

Instantly share code, notes, and snippets.

View AlexEshoo's full-sized avatar

Alex AlexEshoo

View GitHub Profile
@schmich
schmich / ducky.md
Last active July 10, 2024 10:25
Programming media keys on the Ducky One 2 Skyline

Programming Media Keys on the Ducky One 2 Skyline

To use media keys on the Ducky One 2 Skyline, you must record a macro to bind the media function to a hotkey combination, i.e. Fn plus some key.

Example

Important: In the instructions below, "Press X+Y+Z" means press and hold key X, press and hold key Y, press and hold key Z in that order, and then release all three.

As an example, to bind Fn+PgUp to the play/pause media function:

@pdp7
pdp7 / beaglebone-spidev-test.md
Last active February 14, 2022 18:29
beaglebone-spidev-test

Loopback

/boot/uEnv.txt

uname_r=4.4.39-ti-r79
cmdline=coherent_pool=1M quiet cape_universal=enable
cape_enable=bone_capemgr.enable_partno=cape-universala
@Garrett-R
Garrett-R / gzip_str.py
Last active March 12, 2022 10:17
Demo of how to gzip and gunzip a string in Python 3
"""How to gzip a string.
This works for Python 3.2. For 3.1-, look at the original gist (under "Revisions")
"""
import gzip
def gzip_str(string_: str) -> bytes:
return gzip.compress(string_.encode())
@guillaumevincent
guillaumevincent / README.md
Last active June 23, 2024 23:59
Windows Service with Python 3.5 and pyinstaller

How to setup AWS lambda function to talk to the internet and VPC

I'm going to walk you through the steps for setting up a AWS Lambda to talk to the internet and a VPC. Let's dive in.

So it might be really unintuitive at first but lambda functions have three states.

  1. No VPC, where it can talk openly to the web, but can't talk to any of your AWS services.
  2. VPC, the default setting where the lambda function can talk to your AWS services but can't talk to the web.
  3. VPC with NAT, The best of both worlds, AWS services and web.
@pylover
pylover / inspections.txt
Last active July 25, 2024 15:18 — forked from ar45/inspections.txt
PyCharm inspections
# Extracted using: $ unzip -p lib/pycharm.jar com/jetbrains/python/PyBundle.properties | grep -B1 INSP.NAME | grep '^#' | sed 's|Inspection||g' | sed -e 's|#\s\{,1\}|# noinspection |'
# noinspection PyPep8
# noinspection PyPep8Naming
# noinspection PyTypeChecker
# noinspection PyAbstractClass
# noinspection PyArgumentEqualDefault
# noinspection PyArgumentList
# noinspection PyAssignmentToLoopOrWithParameter
# noinspection PyAttributeOutsideInit
@jazzycamel
jazzycamel / threads1.py
Last active July 12, 2024 18:52
Simple example of the correct way to use (Py)Qt(5) and QThread
# Copyright (c) 2016 Rob Kent (jazzycamel)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software
# and associated documentation files (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge, publish, distribute,
# sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or
# substantial portions of the Software.
@mgrandi
mgrandi / config.py
Last active March 11, 2020 23:14
Example Windows Service, written using asyncio and frozen using cx_Freeze
# for NAME and DISPLAY_NAME, the '%s' is replaced whatever you pass to <service.exe> --install NAMEHERE, so you can
# register the same exe multiple times with different names and configuration files
NAME = 'cx_FreezeSampleService%s' # what the name of the service is, used in command line things like "sc"
DISPLAY_NAME = 'cx_Freeze Sample Service - %s' # display name of the service, this is what you see in the "Services" window
MODULE_NAME = 'service' # python file containing the actual service code
CLASS_NAME = 'Handler' # class name of the service, since it doesn't extend anything, all it needs are certain methods
DESCRIPTION = 'Sample service description' # description of the service, seen in the Service Properties window
AUTO_START = False # does the service auto start?
# does the service respond to session changes? Setting this to True and implemnting SessionChanged(sessionId, eventType)
@elyezer
elyezer / ring_buffer.sql
Last active May 16, 2024 03:38
How to create a ring buffer table in SQLite
-- Example table
CREATE TABLE ring_buffer (id INTEGER PRIMARY KEY AUTOINCREMENT, data TEXT);
-- Number 10 on where statement defines the ring buffer's size
CREATE TRIGGER delete_tail AFTER INSERT ON ring_buffer
BEGIN
DELETE FROM ring_buffer WHERE id%10=NEW.id%10 AND id!=NEW.id;
END;
@yosemitebandit
yosemitebandit / send_pdf_with_boto_ses.py
Created June 6, 2012 17:56
send PDF attachment with boto and SES
''' quick example showing how to attach a pdf to multipart messages
and then send them from SES via boto
'''
from email.mime.text import MIMEText
from email.mime.application import MIMEApplication
from email.mime.multipart import MIMEMultipart
import boto