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
| # Windows 11 Time resync script | |
| # Place this batch script inside your home directory | |
| # Use Task scheduler and create a simple task with Max Elevation Priority that start with windows session | |
| echo start sync | |
| net start w32time | |
| w32tm /resync | |
| echo sync complete |
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 psutil | |
| def mem_info(): | |
| a= psutil.virtual_memory().available* 100 / psutil.virtual_memory().total | |
| print("percent of available memory :",a) | |
| if __name__ == "__main__": | |
| mem_info() |
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://askubuntu.com/questions/541781/how-to-install-a-list-of-packages-using-apt-get | |
| 'pkglist' is a file containning the list of package to install | |
| sudo apt-get -y install $(cat pkglist) | |
| or | |
| while read -r line; do sudo apt-get -y install "$line"; done < /path/to/the/packages/pkglist | |
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
| // Calculate the diff of two SD. | |
| // the data tab as 12 value and the 6 first values produce the same | |
| // SD as the 6 last | |
| #include <math.h> | |
| #include <stdio.h> | |
| #define tsize 12 | |
| unsigned int data[tsize]={3894,3894,3865,3865,3807,3807,388,288,231,231,201,201}; |
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
| // Online C compiler to run C program online | |
| // https://www.programiz.com/c-programming/online-compiler/ | |
| // print the bit set of a number | |
| #include <stdio.h> | |
| int main() { | |
| // 1, 2, 4, 8, 10, 20, 40, 80 | |
| printf("Start \n\r"); | |
| unsigned int i; | |
| unsigned int N = 0xFD; // 32-bit word to find the log base 2 of |
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
| # Cal Fibonaci number and display calculation time | |
| # For n=2000000 takes 44s on my W10 I5-2500K PC | |
| import time | |
| def fibo(n): | |
| a=0 | |
| b=1 | |
| for N in range(n): | |
| b, a = a+b, b | |
| return b |
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
| typedef void (*pFunction)(void); | |
| pFunction JumpToApplication; | |
| uint32_t JumpAddress; | |
| /* Jump to user application */ | |
| JumpAddress = *(__IO uint32_t*) (APPLICATION_ADDRESS + 4); | |
| JumpToApplication = (pFunction) JumpAddress; | |
| /* Initialize user application's Stack Pointer */ |
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
| /** | |
| * @brief Convert a string to an integer | |
| * @param p_inputstr: The string to be converted | |
| * @param p_intnum: The integer value | |
| * @retval 1: Correct | |
| * 0: Error | |
| */ | |
| uint32_t Str2Int(uint8_t *p_inputstr, uint32_t *p_intnum) | |
| { | |
| uint32_t i = 0, res = 0; |
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
| void Int2Str(uint8_t *p_str, uint32_t intnum) | |
| { | |
| uint32_t i, divider = 1000000000, pos = 0, status = 0; | |
| for (i = 0; i < 10; i++) | |
| { | |
| p_str[pos++] = (intnum / divider) + 48; | |
| intnum = intnum % divider; | |
| divider /= 10; |
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
| // STEP 1 | |
| /* First edit the compiler file *.ld */ | |
| /* Example with a STM32(128K/36k) in the compiler file add to memories definition */ | |
| /*****************************************************************************************************/ | |
| /* Memories definition */ | |
| MEMORY |
NewerOlder