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
| /* | |
| 2024-04-10 | |
| Office Scripts - Excel - reorder columns based on header row | |
| This script checks if the header row is in the correct order. If not, it rearranges the columns to match the order. | |
| The order is defined in the order array. | |
| Instructions: | |
| 1. Create a new Excel workbook for this example, assuming name is Sheet1. | |
| 2. Enter some data in the columns. | |
| 3. Create a new worksheet and name it "Sheet1_order". |
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
| # Kindall - https://stackoverflow.com/questions/8315389/how-do-i-print-functions-as-they-are-called | |
| def tracefunc(frame, event, arg, indent=[0]): | |
| if event == "call": | |
| indent[0] += 2 | |
| print("-" * indent[0] + "> call function", frame.f_code.co_name) | |
| elif event == "return": | |
| print("<" + "-" * indent[0], "exit function", frame.f_code.co_name) | |
| indent[0] -= 2 | |
| return tracefunc |
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
| # source: Sadrach Pierre https://builtin.com/data-science/python-wrapper | |
| from functools import wraps | |
| def runtime_monitor(input_function): | |
| @functools.wraps(input_function) | |
| def runtime_wrapper(*args, **kwargs): | |
| start_value = time.perf_counter() | |
| return_value = input_function(*args, **kwargs) | |
| end_value = time.perf_counter() | |
| runtime_value = end_value - start_value |
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
| ALTER TABLE your_table | |
| ADD COLUMN last_update TEXT; | |
| CREATE TRIGGER update_last_update | |
| AFTER UPDATE | |
| ON Your_Table_Name | |
| FOR EACH ROW | |
| BEGIN | |
| UPDATE Your_Table_Name | |
| SET last_update = CURRENT_TIMESTAMP |
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 | |
| echo "================UFW SCRIPT Start=====================" | |
| # IP List for Israel is based on: | |
| # https://www.nirsoft.net/countryip/il.html | |
| #### Recommendeda allow Web Server | |
| #ufw allow 80 | |
| # Recommended to add your server's IP address |
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
| ================== | |
| #1 Edit the following file | |
| /etc/ssmtp/ssmtp.conf | |
| ================== | |
| #2 File should look like: | |
| # | |
| # Config file for sSMTP sendmail | |
| # | |
| # The person who gets all mail for userids < 1000 | |
| # Make this empty to disable rewriting. |