Skip to content

Instantly share code, notes, and snippets.

View przemoc's full-sized avatar

Przemysław Pawełczyk przemoc

View GitHub Profile
/* SPDX-License-Identifier: MIT */
/*
* Copyright (C) 2009 Przemyslaw Pawelczyk <przemoc@gmail.com>
*
***** Description ************************************************************
*
* Simple (and incomplete) syscalls interposition for accessing fixed-size Sun
* xVM VirtualBox Virtual Disk Images (.vdi files), especially using sfdisk.
*
***** License ****************************************************************
@przemoc
przemoc / xopen.c
Last active February 6, 2018 14:52
How to open a file and create all needed directories along the way - http://stackoverflow.com/q/11147850/241521
/* SPDX-License-Identifier: MIT */
/*
* Copyright (C) 2012 Przemyslaw Pawelczyk <przemoc@gmail.com>
*
* This code is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
#include <errno.h>
#include <fcntl.h>
@przemoc
przemoc / alpha.cpp
Last active February 6, 2018 14:39
How to check whether alpha channel is used in ARGB32 QImage - http://stackoverflow.com/q/6157286/241521
// SPDX-License-Identifier: MIT
// Copyright (C) 2011 Przemyslaw Pawelczyk <przemoc@gmail.com>
//
// This script is licensed under the terms of the MIT license.
// https://opensource.org/licenses/MIT
bool useAlpha = false;
const uchar* pixelData = image.bits();
int bytes = image.byteCount();
@przemoc
przemoc / validations.rb
Last active February 6, 2018 14:29
Validation of IBAN, ISBN, ISSN, UESRP, NER and VATIN numbers
# SPDX-License-Identifier: MIT
## Copyright (C) 2010 Przemyslaw Pawelczyk <przemoc@gmail.com>
##
## This script is licensed under the terms of the MIT license.
## https://opensource.org/licenses/MIT
module Validations # version 0.1
# International Bank Account Number
def iban?
@przemoc
przemoc / abuild.sh
Last active February 6, 2018 14:11
Simplistic abuild wrapper for building packages out-of-the-tree.
#!/bin/sh
# SPDX-License-Identifier: MIT
## Copyright (C) 2017 Przemyslaw Pawelczyk <przemoc@gmail.com>
##
## This script is licensed under the terms of the MIT license.
## https://opensource.org/licenses/MIT
#
# abuild.sh
# Simplistic abuild wrapper for building packages out-of-the-tree.
@przemoc
przemoc / reassemble_arguments.sh
Last active February 6, 2018 14:05
Reassemble arguments (support-most-cases implementation) in POSIX shell - Transforming "$*" into "$@"
#!/bin/sh
# SPDX-License-Identifier: MIT
## Copyright (C) 2016 Przemyslaw Pawelczyk <przemoc@gmail.com>
##
## This script is licensed under the terms of the MIT license.
## https://opensource.org/licenses/MIT
# Reassemble arguments (support-most-cases implementation)
@przemoc
przemoc / tmux-vm.sh
Last active February 6, 2018 13:54
Set up log/debug Linux kernel session w/ QEMU in tmux
#!/bin/sh
# SPDX-License-Identifier: MIT
## Copyright (C) 2012 Przemyslaw Pawelczyk <przemoc@gmail.com>
##
## This script is licensed under the terms of the MIT license.
## https://opensource.org/licenses/MIT
LDIR="$HOME/qemu"
KDIR="$LDIR/$1"
@przemoc
przemoc / calcswsa.sh
Last active February 6, 2018 13:50
Shell script for calculating Sec-WebSocket-Accept from Sec-WebSocket-Key
#!/bin/sh
# SPDX-License-Identifier: MIT
## Copyright (C) 2013 Przemyslaw Pawelczyk <przemoc@gmail.com>
##
## This script is licensed under the terms of the MIT license.
## https://opensource.org/licenses/MIT
_calcswsa()
{
#!/bin/sh
# SPDX-License-Identifier: MIT
## Copyright (C) 2013 Przemyslaw Pawelczyk <przemoc@gmail.com>
##
## This script is licensed under the terms of the MIT license.
## https://opensource.org/licenses/MIT
#
# Simple script for downloading program stored on CNET:
# - AOMEI Partition Assistant Standard
@przemoc
przemoc / siemens.gawk
Last active February 6, 2018 13:18
Siemens ringtone converter v. 0.3 // taken from pcspk 0.0.6: http://wiki.przemoc.net/projects/pcspk
#!/usr/bin/gawk -f
# SPDX-License-Identifier: GPL-2.0-only
## (C) Copyright 2007-2008 Przemyslaw Pawelczyk <przemoc@gmail.com>
##
## This script is licensed under the terms of the GNU GPL v2 only license.
## https://www.gnu.org/licenses/gpl-2.0.html
#
# Siemens ringtone converter v. 0.3
#