Skip to content

Instantly share code, notes, and snippets.

View gunchev's full-sized avatar

Doncho N. Gunchev gunchev

View GitHub Profile
@chrislongo
chrislongo / gdbinit
Created August 14, 2012 17:50 — forked from CocoaBeans/gdbinit
.gdbinit - A user-friendly gdb configuration file
# INSTALL INSTRUCTIONS: save as ~/.gdbinit
#
# DESCRIPTION: A user-friendly gdb configuration file.
#
# REVISION : 7.3 (16/04/2010)
#
# CONTRIBUTORS: mammon_, elaine, pusillus, mong, zhang le, l0kit,
# truthix the cyberpunk, fG!, gln
#
# FEEDBACK: https://www.reverse-engineering.net
@NicolasT
NicolasT / nonblocking.py
Last active May 27, 2024 17:03
Using the 'splice' syscall from Python, in this demonstration to transfer the output of some process to a client through a socket, using zero-copy transfers. See 'splice.py'. Usage: 'python splice.py' in one console, then e.g. 'nc localhost 9009' in another. 'nonblocking.py' is a demonstration of using 'splice' with non-blocking IO.
'''
Demonstration of using `splice` with non-blocking IO
Lots of code is similar to 'splice.py', take a look at that module for more
documentation.
'''
import os
import os.path
import errno
@moregeek
moregeek / ferm.conf
Created November 26, 2013 08:35
Portknocking with ferm example
domain (ip) {
table filter {
#
# Subchains: Portknocking
# ################################################################################
chain PORT_KNOCKING_1 {
protocol tcp {
mod recent name "port_knock_seq_01" set NOP;
}
@shimarin
shimarin / block_device_sector_size.py
Last active January 11, 2024 13:24
Determining block device's sector size in Linux+Python
#!/usr/bin/python
import fcntl
import os
import struct
import array
import sys
BLKGETSIZE=0x1260
BLKGETSIZE64=0x80081272
BLKSSZGET=0x1268
@smirn0v
smirn0v / gist:b8e6c4bedebed23a0328
Last active February 24, 2023 09:44
Edit gerrit project config
# checkout
git fetch origin refs/meta/config:refs/remotes/origin/meta/config
git checkout meta/config
#directly:
git push origin meta/config:meta/config
#via review:
git push origin meta/config:refs/for/refs/meta/config
@nextrevision
nextrevision / pulp_upload.py
Last active September 9, 2023 12:08
Upload RPM to Pulp Repository and Publish
#!/usr/bin/env python
import os
import sys
import requests
import argparse
import json
import time
pulp_user = 'admin'
@gabrieljcs
gabrieljcs / lvm-cache-fedora.md
Last active July 14, 2024 11:47
Instructions to create an LVM cache for root in Fedora

LVM cache in Fedora

From the man-pages: "The cache logical volume type uses a small and fast LV to improve the performance of a large and slow LV. It does this by storing the frequently used blocks on the faster LV. LVM refers to the small fast LV as a cache pool LV. The large slow LV is called the origin LV. Due to requirements from dm-cache (the kernel driver), LVM further splits the cache pool LV into two devices - the cache data LV and cache metadata LV. The cache data LV is where copies of data blocks are kept from the origin LV to increase speed. The cache metadata LV holds the accounting information that specifies where data blocks are stored (e.g. on the origin LV or on the cache data LV). Users should be familiar with these LVs if they wish to create the best and most robust cached logical volumes. All of these associated LVs must be in the same VG."

Assuming LVM is already setup in HDD (e.g. from anaconda) and SSD is untouched.

Create a physical

@weigon
weigon / lz4.py
Last active June 21, 2023 19:03
LZ4 uncompress in pure python
# Copyright 2016,2020 Jan Kneschke <jan@kneschke.de>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
@imayobrown
imayobrown / migrate_jenkins_job.py
Last active January 26, 2023 20:44
Python script to migrate jenkins job from one sever to another via config.xml file
# Script to migrate jenkins job from one server to another via cli
# Make sure python-jenkins is installed in order to use script
import argparse
import jenkins
def get_parser():
parser = argparse.ArgumentParser()
parser.add_argument('-j', '--job_name', type=str, required=True, help='Name of job that is to be migrated')
parser.add_argument('-o', '--original_server', type=str, required=True, help='Server to migrate from')
@mbinna
mbinna / effective_modern_cmake.md
Last active July 20, 2024 22:17
Effective Modern CMake

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft