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
| SELECT * FROM sys.time_zone_info; -- list available timezones | |
| SELECT | |
| -- CONVERT to VARCHAR because Ignition JDBC can't use datetimeoffset type | |
| CONVERT(VARCHAR, GETDATE() AT TIME ZONE 'Mountain Standard Time') as local_mnt, -- server timezone is Mountain, server stores datetime in this timezone | |
| CONVERT(VARCHAR, SWITCHOFFSET(GETDATE() AT TIME ZONE 'Mountain Standard Time', -420)) as local_mnt2, | |
| CONVERT(VARCHAR, GETDATE() AT TIME ZONE 'Mountain Standard Time' AT TIME ZONE 'Eastern Standard Time') as est, -- convert to Eastern | |
| CONVERT(VARCHAR, SWITCHOFFSET(GETDATE() AT TIME ZONE 'Mountain Standard Time', -300)) as est_2, -- convert to Eastern except using Eastern's timezone offset in minutes | |
| CONVERT(VARCHAR, SWITCHOFFSET(TODATETIMEOFFSET(GETDATE(), -420), -300)) as est_3, -- convert using offset in minutes for local Mountain time and Eastern time | |
| DATEDIFF_BIG(MILLISECOND, '1970-01-01', GETDATE() AT TIME ZONE 'Mountain Standard Time') as unix_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
| # https://stackoverflow.com/questions/35670755/the-mysql-service-on-local-computer-started-and-then-stopped | |
| # Will output error to console | |
| bin\mysqld --defaults-file="C:\Program Files\MySQL\MySQL Server 5.0\my.ini" --standalone --console |
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://www.abhinavbit.com/2019/05/gtid-replication-skip-transaction-using.html | |
| -- In command line interface (bin/mysql): | |
| show slave status \G; | |
| -- In Workbench: | |
| show slave status; | |
| -- Find the Master_UUID column and note the value | |
| -- example: 11387751-34f3-11e4-a177-005056881ef0 | |
| -- Find the Executed_Gtid_Set column and find the Master_UUID set | |
| -- example: Executed_Gtid_Set: 11387751-34f3-11e4-a177-005056881ef0:1233-86906 |
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
| ---- General Log (All Queries Executed) ---- | |
| -- show variables like '%general%'; -- returns variables "general_log" and "general_log_file" | |
| -- show variables like '%log_output%'; -- shows if "log_output" is going to FILE, TABLE or both | |
| -- SET GLOBAL general_log = 1; -- enable general log | |
| -- SET GLOBAL general_log = 0; -- disable general log | |
| -- SET GLOBAL log_output = 'TABLE'; -- sets general log to table mysql.general_log | |
| -- SET GLOBAL log_output = 'FILE'; -- sets general log to file specified by "general_log_file" | |
| -- select general logs, and display argument as text (stored as blob) | |
| SELECT |
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
| SHOW events; -- show events on current schema (https://stackoverflow.com/questions/9057525/how-do-i-see-all-mysql-events-that-are-running-on-my-database) | |
| -- SHOW CREATE EVENT event_name; -- This statement displays the CREATE EVENT statement needed to re-create a given event | |
| -- DROP EVENT event_name; -- Drop (delete) the target event | |
| ---- EXAMPLE EVENT CREATION ---- https://stackoverflow.com/questions/9343001/is-my-mysql-general-log-table-getting-too-big | |
| delimiter | -- needed for multiple statements after DO BEGIN | |
| CREATE EVENT `prune_general_log` ON SCHEDULE | |
| EVERY 1 DAY STARTS '2021-02-05 08:00:00' | |
| ON COMPLETION PRESERVE -- preserve event after expiration |
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
| sudo apt-get install python3-venv # install venv for system Python | |
| python3 -m venv <venv_name> # create venv directory at <venv_name> | |
| . <venv_name>/bin/activate # activate the enviroment | |
| # or (if not in bash and in terminal): | |
| # source <venv_name>/bin/activate | |
| pip install --upgrade pip |
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
| Compile: | |
| - $ g++ <file.cpp> -o <binary_file> | |
| - Ex: $ g++ hello_world.cpp -o hello_world | |
| - Ex Windows: >C:\MinGW\bin\g++ hello_world.cpp -o hello_world.exe | |
| - OpenCV included: $ g++ <file.cpp> -o <binary_file> `pkg-config --cflags --libs opencv` | |
| Run: | |
| - $ ./<binary_file> |