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
//create first a directory called chroot! | |
#include <unistd.h> | |
#include <stdlib.h> | |
#include <fcntl.h> | |
#include <dirent.h> | |
#include <stdio.h> | |
#include <sys/types.h> | |
void printDirInformation(DIR* dir) { |
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 <errno.h> | |
#include <sys/types.h> | |
#include <sys/inotify.h> | |
#include <unistd.h> | |
#include <limits.h> | |
#include <string.h> | |
#define EVENT_SIZE ( sizeof (struct inotify_event) ) | |
#define EVENT_BUF_LEN ( 1024 * ( EVENT_SIZE + 16 ) ) |
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
~$ objdump -d -S a.out | |
a.out: file format elf64-x86-64 | |
Disassembly of section .init: | |
00000000000006e0 <_init>: | |
6e0: 48 83 ec 08 sub $0x8,%rsp | |
6e4: 48 8b 05 fd 18 20 00 mov 0x2018fd(%rip),%rax # 201fe8 <__gmon_start__> |
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
// cat /usr/include/asm-generic/unistd.h | |
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ | |
#include <asm/bitsperlong.h> | |
/* | |
* This file contains the system call numbers, based on the | |
* layout of the x86-64 architecture, which embeds the | |
* pointer to the syscall in the table. | |
* | |
* As a basic principle, no duplication of functionality |
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
# queue using two stacks | |
class MyQueue: | |
_stack1 = list() | |
_stack2 = list() | |
def push(self, value): | |
while( len(self._stack2) != 0): | |
self._stack1.append(self._stack2.pop()) |
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
import math | |
class Node: | |
def __init__(self, value, left, right): | |
self.value = value | |
self.left = left | |
self.right = right | |
def __str__(self): | |
return str([str(self.value), str(self.left) if self.left != None else None, str(self.right) if self.right != None else None ]) |
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
def find_lowest_not_exists(array): | |
max_len = len(array)-1 | |
min = 0 | |
ri = max_len | |
while(ri > 0): | |
idx = 0 | |
while(idx < ri): | |
if(array[idx] <= min): |
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
def move_left(array): | |
idx = 0 | |
ri = len(array)-1 | |
while(idx < ri): | |
if(array[idx] <= 0): | |
array[idx], array[ri] = array[ri], array[idx] | |
ri -=1 | |
else: |
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
def shift_array(array): | |
array.insert(0,0) | |
return array | |
def unshift_array(array): | |
array.pop(0) | |
return array | |
def increase(input): | |
if input[0] == 9 : | |
input = shift_array(input) |
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
struct Node { | |
int value; | |
unsigned int pnx; | |
}; | |
unsigned int XOR(struct Node* a, struct Node* b){ | |
return (unsigned int)a ^ (unsigned int)b; | |
} | |
struct Node* insert_first(int value, struct Node* next){ |