Value | Color |
---|---|
\e[0;30m | Black |
\e[0;31m | Red |
\e[0;32m | Green |
\e[0;33m | Yellow |
\e[0;34m | Blue |
\e[0;35m | Purple |
This file contains hidden or 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
diskutil list | |
diskutil unmountDisk /dev/disk2 | |
diskutil eraseDisk FAT32 SANDISK /dev/disk2 |
This file contains hidden or 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 boto3 | |
def list_s3_objects(bucket_name, prefix='', depth=0, page_size=100, start_after='', max_pages=10): | |
""" | |
Lists all objects in an S3 bucket at a certain "depth" (number of slashes in the key), optionally filtered by a prefix, and paginates results. | |
Returns a list of dictionaries containing object metadata. | |
Args: | |
bucket_name (str): Name of the S3 bucket. | |
prefix (str): Prefix to filter objects by (default ''). |
This file contains hidden or 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 boto3 | |
def list_s3_objects(bucket_name, prefix='', page_size=100, start_after='', max_pages=10): | |
""" | |
Lists all objects in an S3 bucket, optionally filtered by a prefix, and paginates results. | |
Returns a list of dictionaries containing object metadata. | |
Args: | |
bucket_name (str): Name of the S3 bucket. | |
prefix (str): Prefix to filter objects by (default ''). |
This file contains hidden or 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
// Bookmarklet: | |
javascript:(function()%7Bconst%20template%20%3D%20document.createElement(%22template%22)%3B%0Atemplate.innerHTML%20%3D%20%60%0A%20%20%20%20%20%20%20%20%3Cstyle%3E%0A%20%20%20%20%20%20%20%20%20%20%3Ahost%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20box-sizing%3A%20border-box%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20padding%3A%200.5rem%201rem%201.5rem%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20width%3A%20320px%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20border%3A%202px%20solid%20darkgray%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20box-shadow%3A%20grey%200%200%204px%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20background-color%3A%20white%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20position%3A%20absolute%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20right%3A%2010px%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20top%3A%2010px%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20z-index%3A%2010000%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20font-family%3A%20sans-serif%3B%0A%20%20%20%20%20%20%20%20%20%20%7D%0A%0A%20%20%20%20%20%20%20%20%20%2 |
This file contains hidden or 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
function longestPalindrome(s: string): string { | |
let result = ""; | |
let resultLength = 0; | |
for (let i = 0; i < s.length; i++) { | |
// odd length palindromes | |
let leftPointer = i, rightPointer = i; | |
while (leftPointer >= 0 && rightPointer < s.length && s[leftPointer] === s[rightPointer]) { | |
if ((rightPointer - leftPointer + 1) > resultLength) { |
This file contains hidden or 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
// Find the longest length of a substring without repeating characters, e.g. "abcabc" => 3 | |
function lengthOfLongestSubstring(s: string): number { | |
let n = s.length; | |
let longest = 0; | |
let nextIndex = []; | |
for (let right = 0, left = 0; right < n; right++) { | |
left = Math.max(nextIndex[s.charAt(right)] || 0, left); | |
longest = Math.max(longest, right - left + 1); | |
nextIndex[s.charAt(right)] = right + 1; |
This file contains hidden or 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
javascript:(function()%7Bvar%20button%20%3D%20document.createElement('button')%3B%0Abutton.type%20%3D%20'button'%3B%0Abutton.innerText%20%3D%20'Sort'%3B%0Abutton.style%20%3D%20'position%3Aabsolute%3Bright%3A45px%3Btop%3A5px%3Bpadding%3A5px'%3B%0Abutton.addEventListener('click'%2C%20sortBriefcaseList)%3B%0A%0Avar%20briefcaseHeader%20%3D%20document.querySelector('%23briefcaseModal%20.dialog-header')%3B%0AbriefcaseHeader.append(button)%3B%0A%0Afunction%20sortBriefcaseList()%20%7B%0A%20%20var%20briefcase%20%3D%20document.querySelector('%23briefcase-contents')%3B%0A%20%20var%20nodes%20%3D%20briefcase.querySelectorAll('%23briefcase-contents%20li')%3B%0A%0A%0A%0A%20%20var%20nodesArray%20%3D%20%5B%5D.slice.call(nodes)%3B%0A%0A%20%20nodesArray.sort((a%2C%20b)%20%3D%3E%20%7B%0A%20%20%20%20var%20aStart%20%3D%20getStartTime(a)%3B%0A%20%20%20%20var%20bStart%20%3D%20getStartTime(b)%3B%0A%0A%20%20%20%20console.log(aStart%2C%20bStart%2C%20new%20Date('1970%2F01%2F01%20'%20%2B%20aStart)%20-%20new%20Date('1970%2F01%2F01%20'%20% |
This file contains hidden or 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
javascript:(function()%7Bvar%20list%20%3D%20document.querySelectorAll(%22.fa-fw.complete%22)%3Blist%5Blist.length-1%5D.scrollIntoView(%7Bbehavior%3A%20%22smooth%22%20%7D)%7D)() |
This file contains hidden or 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
# Get the currently installed version of Chrome | |
# Works in Codebuild Ubuntu image; may need to use `chrome` instead of `google-chrome` elsewhere | |
CHROME_VERSION=$(google-chrome --version | awk -F '[ .]' '{print $3"."$4"."$5}') | |
# Get the compatible version of ChromeDriver based on the Chrome version | |
# See https://chromedriver.chromium.org/downloads/version-selection for more info on how this works | |
CHROME_DRIVER_VERSION=$(wget -qO- chromedriver.storage.googleapis.com/LATEST_RELEASE_$CHROME_VERSION) | |
# With these environment variables, things like webdriver-manager can be called to update with a specific version: | |
# webdriver-manager update --gecko false --versions.chrome $CHROME_DRIVER_VERSION |
NewerOlder