Skip to content

Instantly share code, notes, and snippets.

View pavly-gerges's full-sized avatar
🤖
Electrostat Lab.

Pavly Gerges (pavl_g) pavly-gerges

🤖
Electrostat Lab.
View GitHub Profile
@pavly-gerges
pavly-gerges / Wrapper.java
Last active April 8, 2023 09:18
Generics in java
public class Wrapper {
private Object object;
public Wrapper(Object object) {
this.object = object;
}
public void setObject(Object object) {
this.object = object;
}
@pavly-gerges
pavly-gerges / Disassemble.as
Created April 24, 2023 19:29
Disassemble code
└──╼ $./avr-objdump -S '/home/twisted/GradleProjects/ShiftAvr/shiftavr-examples/build/atmega328p/hello_gpio_write.c.elf'
/home/twisted/GradleProjects/ShiftAvr/shiftavr-examples/build/atmega328p/hello_gpio_write.c.elf: file format elf32-avr
Disassembly of section .text:
00000000 <__vectors>:
0: 0c 94 34 00 jmp 0x68 ; 0x68 <__ctors_end>
4: 0c 94 46 00 jmp 0x8c ; 0x8c <__bad_interrupt>
git rm -r --cached .
git add .
git commit -m "fixing .gitignore"
@pavly-gerges
pavly-gerges / free_buffer_cells.c
Created September 19, 2023 22:24
Example for freeing buffer cells of a pointer to a pointer
// Online C compiler to run C program online
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static inline void freeBufferCells(void** buffer, int count) {
for (int i = 0; i < count; i++) {
free(buffer[i]);
buffer[i] = NULL;
}
@pavly-gerges
pavly-gerges / parport.h
Created May 31, 2024 09:09
Linux `parport.h` IOCTL Magic Macros
/*
* Any part of this program may be used in documents licensed under
* the GNU Free Documentation License, Version 1.1 or any later version
* published by the Free Software Foundation.
*/
#ifndef _PARPORT_H_
#define _PARPORT_H_
/* Start off with user-visible constants */
@pavly-gerges
pavly-gerges / termios.h
Created May 31, 2024 09:31
/usr/include/asm-generic/termios.h
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef _ASM_GENERIC_TERMIOS_H
#define _ASM_GENERIC_TERMIOS_H
/*
* Most architectures have straight copies of the x86 code, with
* varying levels of bug fixes on top. Usually it's a good idea
* to use this generic version instead, but be careful to avoid
* ABI changes.
* New architectures should not provide their own version.
*/
@pavly-gerges
pavly-gerges / ioctl.h
Created May 31, 2024 09:35
Generic IOCTL Macro Functions for all IOCTL routing controls @ `/usr/include/asm-generic/ioctl.h`.
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef _ASM_GENERIC_IOCTL_H
#define _ASM_GENERIC_IOCTL_H
/* ioctl command encoding: 32 bits total, command in lower 16 bits,
* size of the parameter structure in the lower 14 bits of the
* upper 16 bits.
* Encoding the size of the parameter structure in the ioctl request
* is useful for catching programs compiled with old versions
* and to avoid overwriting user space outside the user buffer area.
@pavly-gerges
pavly-gerges / cdrom.h
Created May 31, 2024 09:37
IOCTL Magic encodings for CDROM operation @ `/usr/include/linux/cdrom.h`.
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
* -- <linux/cdrom.h>
* General header file for linux CD-ROM drivers
* Copyright (C) 1992 David Giller, [email protected]
* 1994, 1995 Eberhard Mönkeberg, [email protected]
* 1996 David van Leeuwen, [email protected]
* 1997, 1998 Erik Andersen, [email protected]
* 1998-2002 Jens Axboe, [email protected]
*/
@pavly-gerges
pavly-gerges / wget_google_drive_download.md
Created June 2, 2024 03:51 — forked from emxsys/wget_google_drive_download.md
Download Google Drive files with WGET

How to download files from Google Drive with WGET

Step 1. Get the ID of the file to download

  1. Get a shareable link from Google Drive by right-clicking the file and selecting Get Shareable Link.

  2. Examine the link to get the file's ID. Example:

    https://docs.google.com/open?id=[ID]

Step 2. Download the file with WGET

  1. Build the download URL using the ID obtained in Step 1. Example:
@pavly-gerges
pavly-gerges / error.txt
Created June 5, 2024 23:02
Unusual position independent error
electrostat-lab@electrostat-workstation:~/Sandbox/Electrostatic-Sandbox/electrostatic-sandbox-framework$ ./helper-scripts/ci-cd/compile-e4j.sh
Compiling and Assembling e4j-core
BUILD SUCCESSFUL in 1s
7 actionable tasks: 2 executed, 5 up-to-date
Compiling e4j-native
> Task :electrostatic4j-native:compileX86
-- GCC: /usr/bin/gcc
-- GPP: /usr/bin/g++