Skip to content

Instantly share code, notes, and snippets.

@darealshinji
darealshinji / Makefile
Created July 9, 2017 06:33
simple MD5 checksum tool
SRCS = md5.c md5cmp.c md5hl.c
OBJS = $(SRCS:%.c=%.o)
LD := g++
CC := gcc
STRIP := strip
all: md5
/*
* Copyright (C) 2016 Sven Brauch <mail@svenbrauch.de>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@darealshinji
darealshinji / kbhit.c
Created July 7, 2017 00:09 — forked from vsajip/kbhit.c
Keyboard hit testing
#include <stdio.h>
#include <termios.h>
#include <unistd.h>
#include <fcntl.h>
int kbhit(void)
{
struct termios oldt, newt;
int ch;
int oldf;
@darealshinji
darealshinji / mxe-relocate.sh
Created July 3, 2017 01:48
Shell script helping to relocate an MXE prefix; see https://github.com/mxe/mxe/issues/1700
#!/usr/bin/env bash
help="Relocate an MXE prefix\n\
\n\
Usage: $0 old_path new_path prefix\n\
\n\
old and new paths must be absolute\n\
new path must not be longer than the old one\n\n"
if [ "x$3" = "x" ] || [ "x$2" = "x" ] || [ "x$1" = "x" ]; then
/*
* The MIT License (MIT)
*
* Copyright (c) 2017, djcj <djcj@gmx.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
@darealshinji
darealshinji / libmediainfo-1-fixes.patch
Created May 14, 2017 21:26
libmediainfo build files for MXE
diff --git a/Project/GNU/Library/configure.ac b/Project/GNU/Library/configure.ac
index 9aa1dfe..4927388 100644
--- a/Project/GNU/Library/configure.ac
+++ b/Project/GNU/Library/configure.ac
@@ -359,8 +359,8 @@ if test -e ../../../../ZenLib/Project/GNU/Library/libzen-config; then
elif test "$(command -v libzen-config)" ; then
enable_unicode="$(libzen-config Unicode)"
else
- if pkg-config --exists libzen; then
- enable_unicode="$(pkg-config --variable=Unicode libzen)"
#!/bin/sh
# build on CentOS 6.9 (64 bit)
# https://github.com/probonopd/AppImages/issues/187
# https://github.com/TheAssassin/zsync2/issues/4
# https://launchpad.net/~djcj/+archive/ubuntu/libcurl-slim
set -e
set -x
# https://github.com/mxe/mxe/blob/master/src/curl.mk
version=$(wget -q -O- 'https://curl.haxx.se/download/?C=M;O=D' | \
@darealshinji
darealshinji / wslpath.sh
Last active June 11, 2017 14:21
Like cygpath for "Bash on Windows"
moved to https://github.com/darealshinji/scripts/blob/master/wslpath
--- a/screenfetch-dev
+++ b/screenfetch-dev
@@ -827,6 +827,7 @@
tinycore|tinycore*linux) distro="TinyCore" ;;
cygwin) distro="Cygwin" ;;
haiku) distro="Haiku" ;;
+ umbrella*unix*|umbrella*corporation) distro="Umbrella Unix"; distro_more="Umbrella Unix 2.1.7" ;;
esac
verboseOut "Finding distro...found as '${distro} ${distro_release}'"
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#define LINE_SIZE 255
#include <limits.h>
#ifndef LIBC6_ARCH
# if (__WORDSIZE == 64)