This file contains 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 | |
# | |
# Heavily inspired by https://github.com/dnschneid/crouton/wiki/VirtualBox-udev-integration | |
# | |
vbox_usbnode_path=$(find / -name VBoxCreateUSBNode.sh 2> /dev/null | head -n 1) | |
if [[ -z $vbox_usbnode_path ]]; then | |
echo Warning: VBoxCreateUSBNode.sh file has not been found. | |
exit 1 |
This file contains 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
#include <stdio.h> | |
#define TOLOWER(c) ((c) | 0x20) | |
#define ISLETTER(c) ((unsigned char)(TOLOWER(c) - 'a') < 26) | |
int main(int argc, char *argv[]) | |
{ | |
if (argc != 2 || argv[1][1] != '\0') { | |
puts("Usage: isletter <character>"); | |
return 1; |
This file contains 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
/* | |
* Thanks to my friend Chrysostomos for the solution. | |
*/ | |
#include <stdio.h> | |
int bin_search(int key, int left, int right) | |
{ | |
while (left <= right) { | |
int middle = (left + right) / 2; |
This file contains 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
#include <stdio.h> | |
#include <string.h> | |
#define STRCMP(a, R, b) (strcmp(a,b) R 0) | |
int main(void) | |
{ | |
char *s = "John"; | |
if (STRCMP("john", ==, s)) | |
fputs("The same", stdout); |
This file contains 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
#include <stdio.h> | |
void generate_initializer(char *string, const char *separator) | |
{ | |
static char *sep = ""; | |
printf("%s%s", sep, string); | |
sep = separator; | |
} | |
int main(void) |