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
#!/bin/bash | |
# Switch PHP versions using Homebrew | |
# Example usage: `phps 8.1` | |
# Add to profile with `source phps.sh` | |
function phps() { | |
local new_version=$1 | |
local php_output=$(php -v) | |
local current_version=$(echo "$php_output" | awk '/^PHP/ {print $2}' | cut -d. -f1,2) | |
echo "Switching PHP version from $current_version to $new_version" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 re | |
def parse_tqdm(tqdm_output): | |
# Regex pattern to match different components of the tqdm output, with an optional message | |
pattern = r""" | |
(.*?:)?\s* # Optionally match any leading message ending with a colon (non-capturing) | |
(\d+)%\| # Match the progress percentage | |
[\s\S]*\| # Match the bar separator | |
\s*(\d+)/(\d+) # Match the current and total iterations |
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 yaml | |
import re | |
""" | |
ChatGPT has a tendency to return Yaml content with misplaced colons. | |
Example: | |
```yaml | |
- title: The Great Poopening: Poop Harder | |
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
#!/usr/bin/env sh | |
. "$(dirname -- "$0")/_/husky.sh" | |
getBranchName() | |
{ | |
echo $(git rev-parse --abbrev-ref HEAD) | |
} | |
getMergedBranches() | |
{ |
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
# Linked list Concepts | |
class Node: | |
def __init__(self, data): | |
self.data = data | |
self.next = None | |
class LinkedList: | |
# Function to initialize head | |
def __init__(self): |
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
# db/migrate/create_github_languages.rb | |
# migrations file for github languages table | |
class CreateGithubLanguages < ActiveRecord::Migration[5.2] | |
def change | |
create_table :github_languages do |t| | |
t.string :language | |
t.float :value | |
t.timestamps | |
end | |
end |
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 requests | |
from bs4 import BeautifulSoup | |
import sys | |
import json | |
import os | |
headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'} | |
try: |
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
##NOTHING HERE, JUST FOR GIST TITLE PURPOSES |