Compare commits
No commits in common. "dev" and "Vladch-2024-05-22" have entirely different histories.
dev
...
Vladch-202
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
"user": "Vladch",
|
||||||
|
"email": "vlach@gmail.com",
|
||||||
|
"remotes": [
|
||||||
|
{
|
||||||
|
"name": "r",
|
||||||
|
"protocol": "http",
|
||||||
|
"domain": "qstack.pl",
|
||||||
|
"port": "3000",
|
||||||
|
"token_name": "t",
|
||||||
|
"token": "06f0feae424eec67fae8f59524075eb10bca82eb",
|
||||||
|
"group": "1i-2023",
|
||||||
|
"project": "strlen-c"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1 @@
|
||||||
|
target extended-remote localhost:3333
|
|
@ -14,7 +14,7 @@ _start:
|
||||||
# Clear the bss segment
|
# Clear the bss segment
|
||||||
la a0, __bss_start
|
la a0, __bss_start
|
||||||
la a1, __BSS_END__
|
la a1, __BSS_END__
|
||||||
|
j finish_bss
|
||||||
clear_bss:
|
clear_bss:
|
||||||
bgeu a0, a1, finish_bss
|
bgeu a0, a1, finish_bss
|
||||||
sb x0, 0(a0)
|
sb x0, 0(a0)
|
||||||
|
|
Binary file not shown.
|
@ -1,8 +1,5 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
char * ptr1 = "janek";
|
|
||||||
char * ptr2 = "kowalskii";
|
|
||||||
|
|
||||||
int strlen(char *s)
|
int strlen(char *s)
|
||||||
{
|
{
|
||||||
char *p = s;
|
char *p = s;
|
||||||
|
@ -39,35 +36,14 @@ char *alloc(int n)
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
|
||||||
char * s = "mpabi";
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t wynik =0;
|
|
||||||
wynik = strlen (s);
|
|
||||||
|
|
||||||
asm("nop");
|
struct key{
|
||||||
|
char *word;
|
||||||
|
int8_t count;
|
||||||
char * p1 = alloc(strlen(ptr1));
|
} keytab[10];
|
||||||
strcpy (p1, ptr1);
|
|
||||||
asm("nop");
|
|
||||||
|
|
||||||
char * p2 = alloc(strlen(ptr2));
|
|
||||||
strcpy (p2, ptr2);
|
|
||||||
asm("nop");
|
|
||||||
|
|
||||||
struct point {
|
|
||||||
int16_t x;
|
|
||||||
int16_t y;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct point * ptrS = (struct point *) alloc(sizeof(point));
|
|
||||||
ptrS->x=0x10;
|
|
||||||
ptrS->y=0x20;
|
|
||||||
asm("nop");
|
|
||||||
|
|
||||||
(*ptrS).y= strlen (p1)+ strlen(p2);
|
|
||||||
|
|
||||||
|
struct key * Ptr = (struct key *) alloc(100);
|
||||||
|
asm ("nop");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Binary file not shown.
|
@ -0,0 +1,17 @@
|
||||||
|
# set args 0x1FF80 0x80 0x30
|
||||||
|
# source gdb/z.py
|
||||||
|
|
||||||
|
import gdb
|
||||||
|
import sys
|
||||||
|
|
||||||
|
# Parse arguments from the GDB command
|
||||||
|
args = gdb.string_to_argv(gdb.parameter("args"))
|
||||||
|
if len(args) != 3:
|
||||||
|
print("Usage: source gdb/zero_with_params.py <start_address> <num_bytes> <pattern>")
|
||||||
|
else:
|
||||||
|
start_address = int(args[0], 16) # Convert start address from hex to int
|
||||||
|
num_bytes = int(args[1], 16) # Convert number of bytes from hex to int
|
||||||
|
pattern = int(args[2], 16) # Convert pattern from hex to int
|
||||||
|
|
||||||
|
for i in range(num_bytes):
|
||||||
|
gdb.execute("set *((char*)%x + %x) = %x" % (start_address, i, pattern))
|
|
@ -0,0 +1,5 @@
|
||||||
|
#source gdb/z.py
|
||||||
|
|
||||||
|
import gdb
|
||||||
|
for i in range(0, 128): # 128 bajtów
|
||||||
|
gdb.execute("set *((char*)(0x1FF80 + %x)) = 0xaa" % i)
|
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,111 @@
|
||||||
|
import argparse
|
||||||
|
import json
|
||||||
|
import sys
|
||||||
|
import subprocess
|
||||||
|
import os
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
DEFAULT_CONFIG = {
|
||||||
|
"user": "Vladch",
|
||||||
|
"email": "vlach@gmail.com",
|
||||||
|
"remotes": [{
|
||||||
|
"name": "r", # Zaktualizowano z "default" na "mpabi"
|
||||||
|
"protocol": "http",
|
||||||
|
"domain": "qstack.pl",
|
||||||
|
"port": "3000",
|
||||||
|
"token_name": "t",
|
||||||
|
"token": "06f0feae424eec67fae8f59524075eb10bca82eb",
|
||||||
|
"group": "1i-2023",
|
||||||
|
"project": "strlen-c"
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
|
||||||
|
def load_or_create_config(config_file, args):
|
||||||
|
config_exists = os.path.exists(config_file) and os.stat(config_file).st_size != 0
|
||||||
|
if config_exists:
|
||||||
|
with open(config_file, 'r') as file:
|
||||||
|
config = json.load(file)
|
||||||
|
else:
|
||||||
|
config = DEFAULT_CONFIG.copy()
|
||||||
|
|
||||||
|
# Znajdź istniejące zdalne repozytorium o podanej nazwie
|
||||||
|
remote = next((remote for remote in config['remotes'] if remote['name'] == args.remote), None)
|
||||||
|
|
||||||
|
# Jeśli istnieje zdalne repozytorium i podano argumenty związane z konfiguracją zdalnego repozytorium
|
||||||
|
if remote:
|
||||||
|
for field in ['protocol', 'domain', 'port', 'token_name', 'token', 'group', 'project']:
|
||||||
|
# Aktualizuj tylko, jeśli argument został jawnie podany
|
||||||
|
if getattr(args, field, None) is not None:
|
||||||
|
remote[field] = getattr(args, field)
|
||||||
|
|
||||||
|
# Jeśli zdalne repozytorium nie istnieje, ale podano nazwę, tworzymy nowe zdalne repozytorium
|
||||||
|
elif args.remote:
|
||||||
|
new_remote = {'name': args.remote}
|
||||||
|
for field in ['protocol', 'domain', 'port', 'token_name', 'token', 'group', 'project']:
|
||||||
|
new_remote[field] = getattr(args, field, DEFAULT_CONFIG['remotes'][0].get(field, ''))
|
||||||
|
if new_remote[field] == None:
|
||||||
|
new_remote[field] = DEFAULT_CONFIG['remotes'][0].get(field, '')
|
||||||
|
config['remotes'].append(new_remote)
|
||||||
|
|
||||||
|
# Aktualizuj informacje o użytkowniku i email, tylko jeśli zostały podane
|
||||||
|
if getattr(args, 'user', None):
|
||||||
|
config['user'] = args.user
|
||||||
|
if getattr(args, 'email_domain', None):
|
||||||
|
config['email'] = f"{args.user}@{args.email_domain}"
|
||||||
|
|
||||||
|
# Zapisz zmodyfikowaną konfigurację
|
||||||
|
with open(config_file, 'w') as file:
|
||||||
|
json.dump(config, file, indent=4)
|
||||||
|
|
||||||
|
return config
|
||||||
|
|
||||||
|
|
||||||
|
def init_git_repo(config):
|
||||||
|
user_name = config['user']
|
||||||
|
user_email = config['email']
|
||||||
|
branch_name = f"{user_name}-{datetime.now().strftime('%Y-%m-%d')}"
|
||||||
|
|
||||||
|
if subprocess.run(["git", "rev-parse", "--git-dir"], stderr=subprocess.DEVNULL).returncode != 0:
|
||||||
|
subprocess.run(["git", "init"])
|
||||||
|
subprocess.run(["git", "config", "user.name", user_name])
|
||||||
|
subprocess.run(["git", "config", "user.email", user_email])
|
||||||
|
subprocess.run(["git", "checkout", "-b", branch_name])
|
||||||
|
print("Git repository initialized.")
|
||||||
|
else:
|
||||||
|
print("Already inside a Git repository. Skipping initialization.")
|
||||||
|
|
||||||
|
remotesFromList = str(subprocess.run(["git", "remote", "-v"], capture_output=True).stdout)
|
||||||
|
remotesFromList = remotesFromList.replace('b\'', "").replace('\'', "").split('\\n')
|
||||||
|
for rm in remotesFromList:
|
||||||
|
name = rm.split("\\t")[0]
|
||||||
|
subprocess.run(["git", "remote", "remove", name], stderr=subprocess.DEVNULL)
|
||||||
|
|
||||||
|
for remote in config['remotes']:
|
||||||
|
remote_url = f"{remote['protocol']}://{remote['token_name']}:{remote['token']}@{remote['domain']}:{remote['port']}/{remote['group']}/{remote['project']}"
|
||||||
|
# Usunięcie i ponowne dodanie zdalnego repozytorium, jeśli jest zaktualizowane
|
||||||
|
#subprocess.run(["git", "remote", "remove", remote['name']], stderr=subprocess.DEVNULL)
|
||||||
|
subprocess.run(["git", "remote", "add", remote['name'], remote_url])
|
||||||
|
print(f"Remote '{remote['name']}' added or updated.")
|
||||||
|
|
||||||
|
def main():
|
||||||
|
parser = argparse.ArgumentParser(description="Git repository initializer with custom configuration.")
|
||||||
|
parser.add_argument("--user", help="User name")
|
||||||
|
parser.add_argument("--email_domain", help="Email domain")
|
||||||
|
parser.add_argument("--config", help="Path to the JSON config file", default="conf.json")
|
||||||
|
parser.add_argument("--remote", help="Name of the remote to add or update")
|
||||||
|
parser.add_argument("--protocol", help="Remote protocol")
|
||||||
|
parser.add_argument("--domain", help="Remote domain")
|
||||||
|
parser.add_argument("--port", help="Remote port")
|
||||||
|
parser.add_argument("--token_name", help="Remote token name")
|
||||||
|
parser.add_argument("--token", help="Remote token")
|
||||||
|
parser.add_argument("--group", help="Group name")
|
||||||
|
parser.add_argument("--project", help="Project name")
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
config = load_or_create_config(args.config, args)
|
||||||
|
init_git_repo(config)
|
||||||
|
print("Git repository initialized and configured based on the provided configuration.")
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
Loading…
Reference in New Issue