Skip to content

Instantly share code, notes, and snippets.

@LucK1Y
LucK1Y / gist:78e228401475c042f786550c352307d4
Created April 27, 2024 20:23
Disabling Remote Push but not fetch
# checking remotes
git remote -v
# disabling remote for push
git remote set-url --push <remote_name> no_push
@LucK1Y
LucK1Y / patharg.py
Created March 23, 2024 20:02
Extension for Argparser for files/directory paths. Stolen from here: https://stackoverflow.com/questions/11415570/directory-path-types-with-argparse
from argparse import ArgumentTypeError as err
import os
class PathType(object):
def __init__(self, exists=True, path_type="file", dash_ok=True):
"""exists:
True: a path that does exist
False: a path that does not exist, in a valid parent directory
None: don't care
@LucK1Y
LucK1Y / decorators.py
Last active December 14, 2022 12:18
useful python decorators
from time import time
from typing import Callable
def catch_exc_decor(exc_val):
def inner_decor(func: [Callable]):
def inner(*args, **kwargs):
try:
return func(*args, **kwargs)
except Exception as ex:
print(f"[X] Caught {ex} in {func.__name__}. Will return ")
@LucK1Y
LucK1Y / sendRawEth.c
Created May 27, 2020 09:09 — forked from austinmarton/sendRawEth.c
Send a raw Ethernet frame in Linux
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*/
#include <arpa/inet.h>
#include <linux/if_packet.h>
#include <stdio.h>
# remove specific file from git cache
git rm --cached filename
# remove all files from git cache
git rm -r --cached .
git add .
git commit -m ".gitignore is now working"
@LucK1Y
LucK1Y / .gitignore
Created March 20, 2020 15:48
Gitignore python with vscode & Pycharm
# Pycharm, VS code
.idea
.vscode
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions