- Create a gist if you haven't already.
- Clone your gist:
# make sure to replace `<hash>` with your gist's hash git clone https://gist.github.com/<hash>.git # with https git clone [email protected]:<hash>.git # or with ssh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# get-docker-socket-from-remote <name> <user>@<host> | |
# Create a unix socket at /tmp/<name>-docker.sock which, when | |
# used will ssh to <user>@<host> and connect to the docker | |
# socket at <host>:///var/run/docker.sock | |
# Note: | |
# 1. This forks a subjob that manages the local socket. | |
# Rmember to kill that when your finished |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker run \ | |
--name {{printf "%q" .Name}} \ | |
{{- with .HostConfig}} | |
{{- if .Privileged}} | |
--privileged \ | |
{{- end}} | |
{{- if .AutoRemove}} | |
--rm \ | |
{{- end}} | |
{{- if .Runtime}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
# http://boto3.readthedocs.io/en/latest/reference/services/ec2.html#service-resource | |
ec2 = boto3.resource('ec2', aws_access_key_id='AWS_ACCESS_KEY_ID', | |
aws_secret_access_key='AWS_SECRET_ACCESS_KEY', | |
region_name='us-west-2') | |
# create VPC | |
vpc = ec2.create_vpc(CidrBlock='192.168.0.0/16') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from concurrent.futures import ThreadPoolExecutor | |
from threading import BoundedSemaphore | |
class BoundedExecutor: | |
"""BoundedExecutor behaves as a ThreadPoolExecutor which will block on | |
calls to submit() once the limit given as "bound" work items are queued for | |
execution. | |
:param bound: Integer - the maximum number of items in the work queue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from contextvars import ContextVar | |
import asyncio | |
import random | |
cv = ContextVar('cv') | |
async def waiting_func(name): | |
print(f'{name} Before sleep: {cv.get() == name}') |
If you have more you can still use this method (3 accounts per instance)
⚠ This guide is for the app available here: https://desktop.telegram.org/ not the one in the Mac/Windows App Store. For the Mac App Store app this should work: https://gist.github.com/Nachtalb/ec590dc974f6ba4674972d4937b230be/#gistcomment-3611415 ⚠
Based on this post: https://qxf2.com/blog/saving-cprofile-stats-to-a-csv-file/
if __name__ == "__main__":
pr = cProfile.Profile()
pr.enable()