Skip to content

Instantly share code, notes, and snippets.

@sfboss
sfboss / sploit.py
Last active June 7, 2024 08:39
sploit.py
import mimetypes
import requests
import urllib.request
import urllib.parse
from urllib.error import URLError, HTTPError
import json
from json import JSONDecodeError
import argparse
import re
import os
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sfboss
sfboss / picklist_ner.py
Created April 21, 2023 23:42
This is a python script for getting named entities from a Salesforce Objects field data
import subprocess
import pandas as pd
import json
import nltk
def get_ners(txt):
from nltk import Tree
from nltk.chunk import ne_chunk
from nltk.tag import pos_tag
from nltk.tokenize import word_tokenize
@sfboss
sfboss / reddituiapi
Created March 20, 2023 00:53
JSON example
{
"fields": {
"AccountNumber": {
"displayValue": null,
"value": null
},
"Active__c": {
"displayValue": null,
"value": null
},
@sfboss
sfboss / query_chats.jq
Created February 14, 2023 04:35
Query chat data from consolidated.json that this file creates
# the steps to get the conversations and CURL string are required before this should be run
# after successfully getting the CURL string and you are in the chatgpt UI and you have updated
# the config to match your setup, these will process from the consolidated.json file that is all of the chats put together
# the consolidation.json is dropped in place when the script for consolidate_json is ran
# this will output the role and message from an array of full json objects
cat ./logs/consolidated.json | jq -c '.[]|{title: .title, mapping: (.mapping | to_entries | map({message: .value.message|{content:.content}, role:.value.message.role}))}'|jq -r '[.mapping[] | {role: .role, message: .message.content.parts[0]}]' | jq .
# this will show only the user questions in the full array of objects:
cat ./logs/consolidated.json | jq -c '.[]|{title: .title, mapping: (.mapping | to_entries | map({message: .value.message|{content:.content}, role:.value.message.role}))}'|jq -r '[.mapping[] | {role: .role, message: .message.c
@sfboss
sfboss / cmitax.json
Created February 3, 2023 09:25
CMI json
[
{
"Id": "0QL6S000007cXt0WAE",
"PricebookEntry": "[object Object]",
"Description": null,
"Quantity": "1",
"TotalPrice": "4950",
"AVA_SFQUOTES__Sales_Tax_Amount__c": "309.38",
"AVA_SFQUOTES__Rate__c": "6.25%",
"AVA_SFQUOTES__Sales_Tax_Details__c": "6.25% State Sales Tax (TEXAS)",
@sfboss
sfboss / test.notes
Created January 31, 2023 04:26
safd
‎‎​
public class Pokemon {
public Integer count;
public String next;
public String previous;
public List<Results> results;
public class Results {
public String name;
public String url;
}
public static Pokemon parse(String json) {
@sfboss
sfboss / Pokemon.cls
Created December 30, 2022 10:37
Pokemon API Deserializer
public class Pokemon {
public Integer count;
public String next;
public String previous;
public List<Results> results;
public class Results {
public String name;
public String url;
}
public static Pokemon parse(String json) {