Compare commits
3 Commits
25aef9000b
...
5538558c7c
Author | SHA1 | Date |
---|---|---|
Alexander Popov | 5538558c7c | |
Alexander Popov | 950d9d2f20 | |
Alexander Popov | d4e2da3838 |
|
@ -21,7 +21,7 @@ indent_style = space
|
|||
indent_size = 4
|
||||
|
||||
# Crystal
|
||||
[{*.cr,shard.yml}]
|
||||
[{*.cr,shards.yml}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
|
@ -80,10 +80,10 @@ indent_size = 4
|
|||
indent_style = tab
|
||||
indent_size = 4
|
||||
|
||||
[~/Gambas/*]
|
||||
[snipplets/code/Gambas/*]
|
||||
indent_size = 2
|
||||
|
||||
[~/Solar2D/**]
|
||||
[snipplets/projects/Solar2D**]
|
||||
indent_style = unset
|
||||
indent_size = unset
|
||||
end_of_line = unset
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
void loop() {
|
||||
Serial.println("Built: " __DATE__ " | " __TIME__);
|
||||
/**
|
||||
* Example show:
|
||||
* Built: Aug 16 2023 | 21:42:32
|
||||
*/
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
// Adapted from http://stackoverflow.com/questions/1765014/convert-string-from-date-into-a-time-t
|
||||
// Formats __DATE__ to YYYY-MM-DD format
|
||||
String ArduinoDateToDisplayDate(char const *time) {
|
||||
char s_month[5];
|
||||
int month, day, year;
|
||||
static const char month_names[] = "JanFebMarAprMayJunJulAugSepOctNovDec";
|
||||
|
||||
sscanf(time, "%s %d %d", s_month, &day, &year);
|
||||
|
||||
month = (strstr(month_names, s_month)-month_names)/3;
|
||||
|
||||
String monthText = month < 10 ? "0" + String(month) : String(month);
|
||||
String dayText = day < 10 ? "0" + String(day) : String(day);
|
||||
|
||||
return String(year) + "-" + monthText + "-" + dayText;
|
||||
}
|
||||
|
||||
// https://gist.github.com/djohnson001/6df673a8d7f8ac04246a
|
|
@ -1,17 +1,17 @@
|
|||
#!/bin/bash
|
||||
|
||||
# TCP
|
||||
#coproc nc -l localhost 3000
|
||||
# coproc nc -l localhost 3000
|
||||
|
||||
# UnixSocket
|
||||
coproc nc -l -U ./app.sock
|
||||
|
||||
while read -r cmd; do
|
||||
case $cmd in
|
||||
d) date ;;
|
||||
q) break ;;
|
||||
*) echo 'Try again?'
|
||||
esac
|
||||
case $cmd in
|
||||
d) date ;;
|
||||
q) break ;;
|
||||
*) echo 'Try again?'
|
||||
esac
|
||||
done <&"${COPROC[0]}" >&"${COPROC[1]}"
|
||||
|
||||
kill "$COPROC_PID"
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
/* size_t strlen(const char *s); */
|
||||
|
||||
size_t length;
|
||||
length = strlen("Example string");
|
|
@ -6,5 +6,5 @@ files=(
|
|||
|
||||
for file in "${files[@]}"
|
||||
do
|
||||
clang-format -i --style=LLVM --sort-includes=false $file
|
||||
clang-format -i --style=LLVM --sort-includes=false $file
|
||||
done
|
||||
|
|
|
@ -8,24 +8,24 @@
|
|||
int g = 0;
|
||||
|
||||
void *my_thread(void *vargp) {
|
||||
int *id = (int *)vargp;
|
||||
int *id = (int *)vargp;
|
||||
|
||||
static int s = 0;
|
||||
static int s = 0;
|
||||
|
||||
++s;
|
||||
++g;
|
||||
++s;
|
||||
++g;
|
||||
|
||||
printf("Thread ID: %d, Static: %d, Global: %d\n", *id, ++s, ++g);
|
||||
printf("Thread ID: %d, Static: %d, Global: %d\n", *id, ++s, ++g);
|
||||
}
|
||||
|
||||
int main() {
|
||||
pthread_t tid;
|
||||
pthread_t tid;
|
||||
|
||||
int i;
|
||||
for (i = 0; i < 3; i++)
|
||||
int i;
|
||||
for (i = 0; i < 3; i++)
|
||||
pthread_create(&tid, NULL, my_thread, (void *)&tid);
|
||||
|
||||
pthread_exit(NULL);
|
||||
pthread_exit(NULL);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue