Skip to content

Instantly share code, notes, and snippets.

View armenzg's full-sized avatar

Armen Zambrano G. armenzg

View GitHub Profile
@armenzg
armenzg / original_line.js
Created July 4, 2023 20:01
Only transform context line
Url: ${et(t)}`),!0)}function ro(t,e){return t.type||!e||!e.length?!1:ao(t).some(n=>pe(n,e))}function oo(t,e){if(t.type!=="transaction"||!e||!e.length)return!1;let n=t.transaction;return n?pe(n,e):!1}function io(t,e){if(!e||!e.length)return!1;let n=et(t);return n?pe(n,e):!1}function so(t,e){if(!e||!e.length)return!0;let n=et(t);return n?pe(n,e):!0}function ao(t){if(t.message)return[t.message];if(t.exception){let{values:e}=t.exception;try{let{type:n="",value:r=""}=e&&e[e.length-1]||{};return[`${r}`,`${n}: ${r}`]}catch{return(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&d.error(`Cannot extract message for event ${U(t)}`),[]}}return[]}function co(t){try{return t.exception.values[0].type==="SentryError"}catch{}return!1}function uo(t=[]){for(let e=t.length-1;e>=0;e--){let n=t[e];if(n&&n.filename!=="<anonymous>"&&n.filename!=="[native code]")return n.filename||null}return null}function et(t){try{let e;try{e=t.exception.values[0].stacktrace.frames}catch{}return e?uo(e):null}catch{return(typeof __SENTRY_DEBUG__>"u"
@armenzg
armenzg / original.js
Created July 4, 2023 19:42
Taken JS file and appended a new line for every semi-colon
import{c as Kt,d as Vt,f as Xt}from"/build/_shared/chunk-3EGTKHIP.js";var Jt=Object.prototype.toString;function ye(t){switch(Jt.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return H(t,Error)}}function ce(t,e){return Jt.call(t)===`[object ${e}]`}function ue(t){return ce(t,"ErrorEvent")}function ke(t){return ce(t,"DOMError")}function it(t){return ce(t,"DOMException")}function v(t){return ce(t,"String")}function fe(t){return t===null||typeof t!="object"&&typeof t!="function"}function O(t){return ce(t,"Object")}function ne(t){return typeof Event<"u"&&H(t,Event)}function st(t){return typeof Element<"u"&&H(t,Element)}function at(t){return ce(t,"RegExp")}function re(t){return Boolean(t&&t.then&&typeof t.then=="function")}function ct(t){return O(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}function ut(t){return typeof t=="number"&&t!==t}function H(t,e){try{return t instanceof e}catch{return!1}}function Oe(t){return t&&t.Math==Math?t:void 0}v
@armenzg
armenzg / requirements.txt
Created August 26, 2022 13:08
Minimum packages to start Sentry's web runner
PyYAML==5.4
beautifulsoup4==4.7.1
boto3==1.22.12
celery==4.4.7
click==8.0.4
croniter==0.3.37
cryptography==37.0.2
django-crispy-forms==1.14.0
django-pg-zero-downtime-migrations==0.11
django==2.2.28
@armenzg
armenzg / get-cli.sh
Created April 18, 2022 13:52
Download old sentry-cli
#!/bin/bash
set -eu
SENTRY_DOWNLOAD_Darwin_arm64="https://downloads.sentry-cdn.com/sentry-cli/1.74.3/sentry-cli-Darwin-arm64"
SENTRY_DOWNLOAD_Darwin_universal="https://downloads.sentry-cdn.com/sentry-cli/1.74.3/sentry-cli-Darwin-universal"
SENTRY_DOWNLOAD_Darwin_x86_64="https://downloads.sentry-cdn.com/sentry-cli/1.74.3/sentry-cli-Darwin-x86_64"
SENTRY_DOWNLOAD_Linux_aarch64="https://downloads.sentry-cdn.com/sentry-cli/1.74.3/sentry-cli-Linux-aarch64"
SENTRY_DOWNLOAD_Linux_armv7="https://downloads.sentry-cdn.com/sentry-cli/1.74.3/sentry-cli-Linux-armv7"
SENTRY_DOWNLOAD_Linux_i686="https://downloads.sentry-cdn.com/sentry-cli/1.74.3/sentry-cli-Linux-i686"
SENTRY_DOWNLOAD_Linux_x86_64="https://downloads.sentry-cdn.com/sentry-cli/1.74.3/sentry-cli-Linux-x86_64"
@armenzg
armenzg / setup-pdm.sh
Created March 28, 2022 17:08
Set up PDM on MacOS for zsh
#!/bin/bash
# This script tries to install PDM on a MacOS host following recommended steps as per https://pdm.fming.dev/#installation
# Currently only supporting Zsh
# This script is designed to allow executing it more than once
set -eu
[[ $(uname) != "Darwin" ]] && echo "Only suppports MacOS setup." && exit 1
[[ "${SHELL}" != "/bin/zsh" ]] && echo "Only suppports zsh shell." && exit 1
# In PDM's output, it is suggested a path to be added to PATH that is very host specific
@armenzg
armenzg / build_macos.sh
Created October 12, 2021 20:17
Build psycopg2-binary 2.8.6 for arm64 (Apple Silicon on M1)
#!/bin/bash
#
# Script to generate arm64 wheels on an Apple Silicon host
#
# Based on https://github.com/psycopg/psycopg2/blob/cefb8181058342b9a4d0bd13b0fad920365d89d5/scripts/build/build_macos.sh
set -euo pipefail
set -x
prjdir=$(git rev-parse --show-toplevel)
@armenzg
armenzg / build.sh
Created September 10, 2021 17:58
Try cross-compiling arm64 psycopg2-binary
#!/bin/bash
#
# Script to generate arm64 wheels on an Apple Silicon host
#
# TODO: File issue on why cross-compiling is not working
set -euo pipefail
create-venv() {
python3 -m venv "${1}"
source "${1}/bin/activate"
#!/bin/bash
set -e
_SENTRY_TRACEBACK_FILE="/var/folders/th/r04rfknj1056pf9tjxwdh6dr0000gn/T/.sentry-05b377db-050c-46bd-bc36-1caec092deea.traceback"
_SENTRY_LOG_FILE="/var/folders/th/r04rfknj1056pf9tjxwdh6dr0000gn/T/.sentry-a75c087a-bda0-49d8-b41a-4c4d18c94df2.out"
trap _sentry_exit_trap EXIT
trap _sentry_err_trap ERR
_sentry_shown_traceback=0
@armenzg
armenzg / sentry-cli.diff
Created March 1, 2021 20:43
Differences with upstream sentry-cli bash-hook
--- scripts/sentry-cli-upstream.sh 2021-03-01 15:41:55.000000000 -0500
+++ scripts/sentry-cli.sh 2021-03-01 15:40:33.000000000 -0500
@@ -1,67 +1,82 @@
+#!/bin/bash
+# This code is mostly the output of calling `sentry-cli bash-hook`
+# This is used by direnv's execution path since the default behaviour of
+# `sentry-cli bash hook` does not work with it. For instance,
+# 1) We should not trap EXIT for direnv needs that untrapped
+# 2) There's a bug on SENTRY_LOG_FILE that is not fully written to disk before reporting
set -e
#!/bin/bash
set -e
# Keep a log. h/t https://stackoverflow.com/a/25319102
bootstrap_sentry=$HOME/.sentry/bootstrap-sentry
mkdir -p $bootstrap_sentry
temp_file=`mktemp $bootstrap_sentry/bootstrap-sentry.log.XXX`
ls $temp_file
exec > >(tee $temp_file)
exec 2>&1