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 <stdbool.h> | |
/* | |
* https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html | |
*/ | |
bool isPowerOf2(unsigned int x) | |
{ | |
/* | |
* Convert # into binary | |
* If there is more than 1 "1", then |
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
global _start | |
section .text | |
_start: | |
; write (sys_write) | |
; %rdi | |
; unsigned int fd | |
; %rsi | |
; const char __user *buf | |
; %rdx |
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 <limits.h> /* for LONG_MAX, INT_MAX */ | |
#include <stdlib.h> | |
#include <stdbool.h> | |
#define IS_ASCII_DIGIT(c) (((c >= 48) && (c <= 57))) | |
long __my_atoi(char* buffer) | |
{ | |
if(buffer == NULL) { |
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
ifconfig eth0 | grep -P '[0-9].[0-9].[0-9].[0-9]$' | awk '{ print $2 }' | awk '{split($0,a,":"); print a[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
objects = main.o Var.o List.o | |
CCFLAGS = -Wall -Wextra -Wpedantic | |
main : $(objects) | |
cc $(CCFLAGS) -o main $(objects) | |
.PHONY : clean | |
clean: | |
rm -f main $(objects) |
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 <iostream> | |
#include <deque> | |
#include <algorithm> | |
#include <iterator> | |
#include <cstring> | |
#include <vector> | |
using namespace std; | |
// non-breaking-s-pace |
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 <iostream> | |
#include <map> | |
#include <string> | |
#include <algorithm> | |
#define NL std::cout << std::endl | |
using namespace std; | |
void __(const char *s) { |
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 <stdlib.h> | |
#include <string.h> | |
#include <ctype.h> | |
/* | |
* const char* const read only | |
* const char* is read/write | |
*/ | |
int find_str_in_str(const char* const base, const char* const sub) |
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> // fprintf | |
#include <stdlib.h> // malloc | |
#include <string.h> // strlen | |
#include <ctype.h> // toupper, tolower | |
/* | |
* a string is an array of characters, in C, all arrays | |
* are always passed never passed value, always a pointer to | |
* the variable | |
* This is why the caller does not need to call the function like: |
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
function camel_case_rev(word) | |
{ | |
if(! word) | |
return; | |
word = (word).toString(); | |
var ret = ""; | |
for(var i = 0; i < word.length; i++) |