This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import concurrent.futures | |
from http.client import HTTPException | |
import threading | |
import time | |
def output(message): | |
print(f"{time.time_ns()}: {message}") | |
invalid_item_names = ["item4", "item6"] | |
fatal_item_names = ["item2"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import requests | |
f=o=i=p="" | |
while not (f and o and i and p): | |
for word in requests.get("https://random-word-api.herokuapp.com/word?lang=en&number=50").json(): | |
if word[0] == "f": | |
f = word | |
if word[0] == "o": | |
o = word | |
if word[0] == "i": |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Started worker and queued sleeper 3 ... 0.00016 | |
running worker for 3 ... 0.00063 | |
Started worker and queued sleeper 9 ... 0.00069 | |
running worker for 9 ... 0.00107 | |
Started worker and queued sleeper 15 ... 0.0011 | |
running worker for 15 ... 0.00145 | |
Started worker and queued sleeper 12 ... 0.00151 | |
running worker for 12 ... 0.0018 | |
Started worker and queued sleeper 6 ... 0.00192 | |
running worker for 6 ... 0.0022 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global class EmptyUpdateBatch implements Database.Batchable<sObject> { | |
global Database.QueryLocator start(Database.BatchableContext BC) { | |
String query = 'SELECT Id FROM !!ObjectType!! WHERE Field = NULL'; | |
return Database.getQueryLocator(query); | |
} | |
global void execute(Database.BatchableContext BC, List<!!ObjectType!!> records) { | |
update records; | |
} | |
global void finish(Database.BatchableContext BC) {} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
matthewpoer@magpie sdp % python3 | |
Python 3.9.7 (default, Oct 13 2021, 06:45:31) | |
[Clang 13.0.0 (clang-1300.0.29.3)] on darwin | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> object_one = {"primary key":"super duper"} | |
>>> object_two = {"primary key":"override", "additional key":"so fun"} | |
>>> object_one.update(object_two) | |
>>> object_one | |
{'primary key': 'override', 'additional key': 'so fun'} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
barList = ["|","/","-","\\"] | |
barListIter = iter(barList) | |
ten_seconds_away = int(time.time()) + 10 | |
while int(time.time()) < ten_seconds_away: | |
remaining = ten_seconds_away - int(time.time()) | |
bar = next(barListIter, None) | |
if not bar: | |
barListIter = iter(barList) | |
bar = next(barListIter) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bugs = { | |
"FirstName": "Bugs", | |
"LastName": "Bunny", | |
"Hometown": { | |
"City": "Los Angeles", | |
"State": "California", | |
"Country": { | |
"ISO": "US", | |
"Text": "United States", | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# only for the Mac folks so we can `sed` like a real boy | |
brew install gnu-sed | |
PATH="$(brew --prefix)/opt/gnu-sed/libexec/gnubin:$PATH" | |
# props to Gearset's blog | |
# https://gearset.com/blog/installed-packages-v43-and-activaterss/ | |
cd force-app/main/default/installedPackages | |
sed -i 's/ xsi:nil="true"\/>/>false<\/activateRSS>/g' *xml | |
cd ../../../../ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> dictionary = {"one":"one value", "two":"two value"} | |
>>> new_dictionary = {"foo":"foo value", "bar":"bar value"} | |
>>> dictionary.update(new_dictionary) | |
>>> print(dictionary) | |
{'one': 'one value', 'two': 'two value', 'foo': 'foo value', 'bar': 'bar value'} | |
>>> dictionary = {"one":"one value", "two":"two value"} | |
>>> new_dictionary = {"foo":"foo value", "bar":"bar value"} | |
>>> dictionary.update({**new_dictionary}) | |
>>> print(dictionary) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CustomException(Exception): | |
def __init__(self, extra_context, message): | |
self.extra_context = extra_context | |
self.message = message | |
super().__init__(self.message) | |
def __str__(self): | |
return f'Shit going down! {self.message} | extra context: {self.extra_context}' | |
try: | |
raise CustomException("extra context", "some message") |
NewerOlder