Skip to content

Instantly share code, notes, and snippets.

View Leiery's full-sized avatar
🥜

Dave Leiery

🥜
View GitHub Profile
@yusufpapurcu
yusufpapurcu / main.py
Created May 6, 2021 10:41
Get last 1 hour of telegram chat with python and telethon
from telethon import TelegramClient
from datetime import datetime, timedelta, timezone
# These example values won't work. You must get your own api_id and
# api_hash from https://my.telegram.org, under API Development.
api_id = 12345
api_hash = '0123456789abcdef0123456789abcdef'
client = TelegramClient('anon.session', api_id, api_hash) # You need run twice because this part create session in first run.
client.start()
@pauloapi
pauloapi / get_lambda_event_source.py
Last active October 10, 2022 17:08
AWS Lambda: Determine Event Source from event object. Based on this javascript gist https://gist.github.com/jeshan/52cb021fd20d871c56ad5ce6d2654d7b
def get_lambda_event_source(self, event: dict):
if 'pathParameters' in event and 'proxy' in event['pathParameters']:
return 'api_gateway_aws_proxy'
if 'requestContext' in event and 'resourceId' in event['requestContext']:
return 'api_gateway_http'
elif 'Records' in event and len(event['Records']) > 0 and 'eventSource' in event['Records'][0] and event['Records'][0]['eventSource'] == 'aws:s3':
return 's3'
elif 'Records' in event and len(event['Records']) > 0 and 'EventSource' in event['Records'][0] and event['Records'][0]['EventSource'] == 'aws:sns':
return 'sns'
@troyfontaine
troyfontaine / 1-setup.md
Last active October 14, 2025 18:46
Signing your Git Commits on MacOS

Methods of Signing Git Commits on MacOS

Last updated March 13, 2024

This Gist explains how to sign commits using gpg in a step-by-step fashion. Previously, krypt.co was heavily mentioned, but I've only recently learned they were acquired by Akamai and no longer update their previous free products. Those mentions have been removed.

Additionally, 1Password now supports signing Git commits with SSH keys and makes it pretty easy-plus you can easily configure Git Tower to use it for both signing and ssh.

For using a GUI-based GIT tool such as Tower or Github Desktop, follow the steps here for signing your commits with GPG.

@phoboslab
phoboslab / mousemove.py
Created June 26, 2012 19:44
Python script to move the mouse cursor in windows with constant speed
import sys
import time
import win32api
if (len(sys.argv) < 4):
print "Usage: python mousemove.py dx dy speed"
sys.exit()
current = win32api.GetCursorPos()
cx = sx = current[0]