Skip to content

Instantly share code, notes, and snippets.

@polosaty
polosaty / sentry-raw.sh
Created September 12, 2024 17:48 — forked from ezy/sentry-raw.sh
CURL request to sentry without an SDK
# Replace <sentry_key>, <sentry-url> and <project-id> to formulate your CURL request. Don't forget to add a trailing slash to URL otherwise you'll get wierd CSRF errors!
curl -X POST --data '{ "exception": [{ "type": "$ErrorMessage"}] }' -H 'Content-Type: application/json' -H "X-Sentry-Auth: Sentry sentry_version=7, sentry_key=<sentry_key>, sentry_client=raven-bash/0.1" https://<sentry-url>/api/<project-id>/store/
#!/usr/bin/python3
import sys
import asyncio
import greenlet
class AsyncIoGreenlet(greenlet.greenlet):
def __init__(self, driver, fn):
greenlet.greenlet.__init__(self, fn, driver)
self.driver = driver
@polosaty
polosaty / cte.sqlalchemy.py
Created January 28, 2022 05:06 — forked from cairabbit/cte.sqlalchemy.py
SqlAlchemy CTE recursive sample
from sqlalchemy.orm import sessionmaker, relationship, aliased
from sqlalchemy import cast, Integer, Text, Column, ForeignKey, literal, null
from sqlalchemy.sql import column, label
class Catalog(Base):
__tablename__ = 'catalog'
id = Column(String, primary_key=True)
parentid = Column(String, ForeignKey('catalog.id'))
name = Column(String)
parent = relationship("Catalog", remote_side=[id])
@polosaty
polosaty / gist:bd69db9b408d93680ecf18a911593a42
Last active April 29, 2021 07:34 — forked from paulakg4/gist:5609036
iPython Notebook example of how to ssh into a remote server and make a local sql backup- uses the sakila library.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@polosaty
polosaty / restore.sh
Last active December 14, 2018 06:12 — forked from anonymous/sh
Gist from «VK CodeSyntaxHighlighter»
sudo -u postgres psql
create database gits_restore;
sudo -u postgres psql gits_restore;
create extension postgis;
cd /backup
sudo -u postgres pg_restore -Fd -d gits_restore --table=route_path ./main-av_gits