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
| ip() { | |
| local ifc addr | |
| ifc=$(route -n get default 2>/dev/null | awk '/interface:/{print $2}') | |
| if [[ -n "$ifc" ]]; then | |
| addr=$(ipconfig getifaddr "$ifc" 2>/dev/null) | |
| if [[ "$addr" =~ ^(10\.|192\.168\.|172\.(1[6-9]|2[0-9]|3[01])\.) ]]; then | |
| echo "$addr" | |
| return | |
| fi | |
| fi |
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
| for f in "$@" | |
| do | |
| # Get the base name of the file without the extension | |
| base_name=$(basename "$f" .png) | |
| # Get the directory where the file is located | |
| dir_name=$(dirname "$f") | |
| # Create a backup with the ".org.png" extension | |
| cp "$f" "$dir_name/$base_name.org.png" |
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
| var trackingCell = 'O1'; | |
| function onEdit(e) { | |
| var sheet = e.source.getActiveSheet(); | |
| var range = e.range; | |
| if (sheet.getName() === 'People' && range.getColumn() === 2) { | |
| var selectedPeople = []; | |
| var peopleRange = sheet.getRange('A2:B'); // Adjust range as needed | |
| var values = peopleRange.getValues(); |
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
| <?php | |
| /** | |
| * Plugin Name: Dynamic Parameters | |
| */ | |
| $dynamic_page_slugs = [ | |
| 'product-detail' => [ // product-detail/12345/awesome_product | |
| 'product_id' => '(\d+)', | |
| 'product_name' => '([a-zA-Z0-9-_]+)', | |
| ], |
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
| on run {input, parameters} | |
| set inputPath to POSIX path of (item 1 of input) | |
| set isFolder to (do shell script "test -d " & quoted form of inputPath & " && echo true || echo false") as boolean | |
| set folderPath to "" | |
| set urlPath to "http://localhost:8124" | |
| if isFolder then | |
| set folderPath to inputPath | |
| else |
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
| # https://<shopify.store.com>/products.json?limit=250 (defaults to 30) | |
| import csv | |
| import json | |
| def convert_json_to_csv(json_file, csv_file): | |
| with open(json_file, 'r', encoding='utf-8') as file: | |
| data = json.load(file) | |
| products = data['products'] |
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
| # Enable | |
| defaults write com.apple.dock appswitcher-all-displays -bool true; killall Dock; | |
| # Revert | |
| defaults delete com.apple.Dock appswitcher-all-displays; killall Dock |
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
| /** | |
| * Expands a textarea element to fit its content up to a maximum height. | |
| * @param {string} id - The id of the textarea element. | |
| * @param {number} [maxHeight=0] - The maximum height of the textarea element. 0 for no maximum. | |
| * @author Christoph Khouri <christoph.khouri@gmail.com> | |
| */ | |
| function expandableTextarea(id, maxHeight = 0) { | |
| const textarea = document.getElementById(id); | |
| textarea.style.height = 'auto'; | |
| textarea.style.height = (textarea.scrollHeight) + 'px'; |
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
| namespace | |
| { | |
| template<typename T1> | |
| void debug(T1 v){ | |
| #ifdef ENABLE_DEBUG | |
| Serial.println(v); | |
| #endif | |
| } | |
| template<typename T2> |
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
| from progressbar import ProgressBar | |
| import requests | |
| from lxml import html | |
| import os | |
| import tqdm | |
| pbar = ProgressBar() | |
| filename = "mmp.urls" |
NewerOlder