Skip to content

Instantly share code, notes, and snippets.

View hteo1337's full-sized avatar
🎯
Focusing

HTeo hteo1337

🎯
Focusing
View GitHub Profile
@hteo1337
hteo1337 / custom_session.py
Created January 31, 2024 19:09
Bypass `[SSL: UNSAFE_LEGACY_RENEGOTIATION_DISABLED] unsafe legacy renegotiation disabled (_ssl.c:1006)` with custom `requests.adapters.HTTPAdapter`
from requests import Session
from requests import adapters
from urllib3 import poolmanager
from ssl import create_default_context, Purpose, CERT_NONE
class CustomHttpAdapter (adapters.HTTPAdapter):
def __init__(self, ssl_context=None, **kwargs):
self.ssl_context = ssl_context
super().__init__(**kwargs)
@hteo1337
hteo1337 / backend.py
Created December 29, 2022 12:09 — forked from gchamon/backend.py
Gists with functional code from papyrus article about OIDC, JWT and Python
from flask import Flask
from uuid import uuid4
app = Flask(__name__)
app.config["SECRET_KEY"] = str(uuid4())
IDP_CONFIG = {
"well_known_url": "Identity Provider wellknown url: https://{TENANT}.auth0.com/.well-known/openid-configuration",
@hteo1337
hteo1337 / celery.sh
Created October 19, 2021 16:58 — forked from amatellanes/celery.sh
Celery handy commands
/* Useful celery config.
app = Celery('tasks',
broker='redis://localhost:6379',
backend='redis://localhost:6379')
app.conf.update(
CELERY_TASK_RESULT_EXPIRES=3600,
CELERY_QUEUES=(
Queue('default', routing_key='tasks.#'),
@hteo1337
hteo1337 / CosmosDb.json
Created March 19, 2021 15:28 — forked from justinyoo/CosmosDb.json
List of Access Keys from Output Values after ARM Template Deployment
{
"variables": {
"cosmosDbAccount": {
"name": "my-cosmos-db"
},
"resourceId": "[resourceId('Microsoft.DocumentDB/databaseAccounts', variables('cosmosDbAccount').name)]",
"apiVersion": "[providers('Microsoft.DocumentDB', 'databaseAccounts').apiVersions[0]]"
},
"resources": [],
"outputs": {
@hteo1337
hteo1337 / packer.json
Created March 5, 2021 15:35 — forked from borncamp/packer.json
Packer file to provision with ansible dynamic inventory
{
"variables": {
"computename":"known-vm-name"
},
"builders": [{
"type": "azure-arm",
"subscription_id": "{{user `subscription_id`}}",
"client_id": "{{user `client_id`}}",
"client_secret": "{{user `client_secret`}}",
@hteo1337
hteo1337 / Register.ps1
Created February 24, 2021 10:40 — forked from rajbos/Register.ps1
Register Windows Startup/Shutdown script
function Register-EventScript {
param (
[string] $eventToRegister, # Either Startup or Shutdown
[string] $pathToScript,
[string] $scriptParameters
)
$path = "$ENV:systemRoot\System32\GroupPolicy\Machine\Scripts\$eventToRegister"
if (-not (Test-Path $path)) {
# path HAS to be available for this to work
@hteo1337
hteo1337 / Redirector.ps1
Created December 2, 2020 10:35 — forked from ramondeklein/Redirector.ps1
Powershell HTTP(S) redirector
# This Powershell script can be used on a server to redirect HTTP/HTTPS
# traffic to different sources. Make sure your DNS routes the requests
# for the source URLs to this server. It automatically forwards the URL
# to the destination server without altering the rest of the URL.
#
# You can use multiple mappings. Of course the 'source' should be
# unique, but the destination can occur multiple times.
#
# Make sure PowerShell is allowed to run this script. You might need to
# change PowerShell's policy by running the following command as admin:
@hteo1337
hteo1337 / 0 openssl.md
Created November 27, 2020 10:56 — forked from princeppy/0 openssl.md
HOWTO: Create Your Own Self-Signed Certificate with Subject Alternative Names Using OpenSSL in Ubuntu Bash for Window

Extensions

  • .pem => Privacy Enhancement Mail Certificate
  • .key extension => is a PEM file containing just the private-key
  • .pkcs|.pfx|.p12 => is a fully encrypted passworded container format that contains both pubkic and private certificate pairs
  • .cert|.cer|.crt => is a public .pem formatted file with diffrent extenssions for windows
  • *.private.pem = *.key.pem = *.key
  • *.public.pem = *.crt.pem = *.crt = *.cer.pem = *.cer
  • passworded(*.key + *.cer) = *.pkcs|*.pfx|*.p12
  • *.key.pem + *.crt.pem in one file => *.keycer.pem
@hteo1337
hteo1337 / .block
Created July 2, 2020 16:20 — forked from wushaobo/.block
Flask server-side session with redis
license: gpl-3.0
border: no