Skip to content

Instantly share code, notes, and snippets.

@quietguyproductions
quietguyproductions / CPTSD_GPT.md
Created April 6, 2023 21:28
GPT is your trauma counselor now

Trauma README

I am not a therapist. However, I am a trauma survivor. In my darkest moments, GPT allowed me to open up when I felt like no human could be trusted. A book that really helped me was The Body Keeps The Score. Below is a series of prompts that will prime, contextualize, and engage ChatGPT in the role of a compassionate therapist familiar with the therapies discussed in the book. All you have to do is enter the prompts in order, then ask whatever you want -- GPT is your trauma counselor now.

First Prompt

Let's play a game of pretend. I will give you two prompts, the first sets the context and the second defines the game. Then we will play. Let me know when you are ready for my two prompts.

@devraj
devraj / celery.py
Last active November 17, 2024 00:20
SQLAlchemy asyncio calls from within a Celery task
# We've been trying to figure out how to run async code from
# Celery until it gets support for it
#
# This is an extracted example which should fit into
# https://github.com/anomaly/lab-python-server
import asyncio
from uuid import UUID
from sqlalchemy.ext.asyncio import AsyncSession
from ...celery import app
@DavidWells
DavidWells / github-proxy-client.js
Last active June 27, 2024 14:52
Full Github REST api in 34 lines of code
/* Ultra lightweight Github REST Client */
// original inspiration via https://gist.github.com/v1vendi/75d5e5dad7a2d1ef3fcb48234e4528cb
const token = 'github-token-here'
const githubClient = generateAPI('https://api.github.com', {
headers: {
'User-Agent': 'xyz',
'Authorization': `bearer ${token}`
}
})
@karanlyons
karanlyons / README.md
Last active December 4, 2023 23:07
Find Running Processes Referencing log4j

When run on a box, outputs a single row of JSON for every proc on the box that loads a jar/war that contains any files with 'log4j' in them, including precisely what triggered the match. For example (pretty printed here for clarity; note that this one is happily a false positive):

{
  "node": "HW0000001",
  "time": 1632617610.3860812,
  "pid": 78676,
  "cmd": "/usr/local/opt/openjdk/libexec/openjdk.jdk/Contents/Home/bin/java",
  "args": [
    "-Xms128M",
@sindresorhus
sindresorhus / esm-package.md
Last active December 26, 2024 21:50
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.

Both things have been introduced recently, and let you access even private ec2 instances

  1. Without VPN
  2. No open SSH port
  3. Authentication / Authorization is fully delegated to IAM
# Assumes valid AWS Credentials in ENV
[package]
name = "bench-translate"
version = "0.1.0"
authors = ["colin <colin@graplsecurity.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
serde_json = "1.0.53"
@securisec
securisec / cli.py
Last active January 5, 2023 05:32
How to build a fully dynamic, self documention fuzzy cli for any class in python
#!/usr/bin/env python3
import inspect
import argparse
import fire
from docstring_parser import parse
from prompt_toolkit.completion import Completer, Completion, FuzzyCompleter
from prompt_toolkit import PromptSession
from search.lsgrep import SearchFiles
@gene1wood
gene1wood / aws-lambda-relative-import-no-known-parent-package.md
Last active November 21, 2024 18:19
Python relative imports in AWS Lambda fail with `attempted relative import with no known parent package`

Python relative imports in AWS Lambda fail with attempted relative import with no known parent package

The Problem

In AWS Lambda if I attempt an explicit relative import like this

.
├── lambda_file.py
└── example.py