Skip to content

Instantly share code, notes, and snippets.

View rofl0r's full-sized avatar

rofl0r

View GitHub Profile
@rofl0r
rofl0r / dist-from-tags.sh
Last active August 29, 2015 14:03
create distro tarballs for all tags in a git repo.
#!/bin/sh
# (C) 2014 rofl0r, released under the public domain.
# this script takes a repo url as arguments and then checks out
# all tags, creates a tarball from each one and prints a hyperlink
# to stdout.
# for example ./dist-from-tags.sh $HOME/git-repos/wavemon > index.html
# the tarballs are created in the current working dir.
url="$1"
this=$PWD
when --disable-shared is used, libgcc is built without hidden visibility.
in combination with 2 other bugs, this leads to miscompilation of
musl libc.so on mips.
these 3 issues combined are:
1. gcc emitting useless .globl
2. gas generating OBJECT symbol rather than unknown type when it sees .globl
without .type
3. libgcc.a symbols not getting hidden visibility like they should
--- gcc473.org/libgcc/Makefile.in
@rofl0r
rofl0r / bb-ping.c
Last active May 30, 2022 08:56
ping utility ripped off from busybox rev 1.22.0, turned into a standalone program + added SOCK_DGRAM functionality for root-free ping and ping6. [ http://lists.busybox.net/pipermail/busybox/2014-January/080206.html rejected SOCK_DGRAM patch as taken from busybox ml]
/* vi: set sw=4 ts=4: */
/*
* Mini ping implementation for busybox
*
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
*
* Adapted from the ping in netkit-base 0.10:
* Copyright (c) 1989 The Regents of the University of California.
* All rights reserved.
*
@rofl0r
rofl0r / ping.c
Created January 4, 2014 20:44
the modified ping tool from http://openwall.info/wiki/people/segoon/ping / http://mirrors.kernel.org/openwall/Owl/3.0-release/sources/Owl-3_0-stable/packages/iputils/iputils-ss020927.tar.gz with the no-suid patch applied and some build errors fixed, as a standalone C file. works, but has no ipv6 support.
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include <sys/param.h>
#include <sys/socket.h>
#include <linux/sockios.h>
#include <sys/file.h>
#include <sys/time.h>
#include <signal.h>
@rofl0r
rofl0r / mlxc.sh
Created November 13, 2013 10:30 — forked from noqqe/mlxc.sh
#!/bin/bash
### Binaries
SCREEN=$(which screen)
LXCSTART=$(which lxc-start)
LXCSTOP=$(which lxc-stop)
### Configuration to get lxc directory
LXCCONF="/etc/default/lxc"
ERR=0
/* Copyright (C) 2013, Felix Janda <felix.janda@posteo.de>
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.
SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
@rofl0r
rofl0r / init.c
Created August 6, 2013 21:15
minimal init daemon by rich felker, author of musl libc
#define _XOPEN_SOURCE 700
#include <signal.h>
#include <unistd.h>
int main()
{
sigset_t set;
int status;
if (getpid() != 1) return 1;
@rofl0r
rofl0r / mkcabundle.pl
Created April 10, 2012 01:15
SSL certificate download script
#!/usr/bin/perl -w
#
# Used to regenerate ca-bundle.crt from the Mozilla certdata.txt.
# Run as ./mkcabundle.pl > ca-bundle.crt
#
my $cvsroot = ':pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot';
my $certdata = 'mozilla/security/nss/lib/ckfw/builtins/certdata.txt';
open(IN, "cvs -d $cvsroot co -p $certdata|")
@rofl0r
rofl0r / sleep.c
Created March 13, 2012 03:04
gnu compatible sleep tool.
#define _POSIX_C_SOURCE 200809L
#include <sys/time.h>
#include <time.h>
#include <stdlib.h>
int main(int argc, char** argv) {
int i;
char* end;
int times;
for(i = 1; i < argc; i++) {
@rofl0r
rofl0r / gist:1073739
Created July 9, 2011 16:53 — forked from angavrilov/gist:926972
mmap injection on linux (emulation of VirtualAllocEx)
/* Support for executing system calls in the context of the game process. */
static const int injection_size = 4;
static const char nop_code_bytes[injection_size] = {
/* This is the byte pattern used to pad function
addresses to multiples of 16 bytes. It consists
of RET and a sequence of NOPs. The NOPs are not
supposed to be used, so they can be overwritten. */
0xC3, 0x90, 0x90, 0x90