Skip to content

Instantly share code, notes, and snippets.

@x3ro
x3ro / keybase.md
Last active September 6, 2016 14:15

Keybase proof

I hereby claim:

  • I am x3ro on github.
  • I am fresskoma (https://keybase.io/fresskoma) on keybase.
  • I have a public key ASCWLW8_UfKTpsTWuji76j_UfzJ2PIRkKRKiV-tcNrpa8Ao

To claim this, I am signing this object:

@x3ro
x3ro / git-foobar.sh
Created November 25, 2015 11:26
Script which shows other commits that touch a file introduced by the given commit
# Didn't find a good name for this yet :D
function git-foobar {
COMMITS=$(git diff-tree --no-commit-id --name-only -r --diff-filter=A $1 | \
xargs git log --pretty="%H" -- | \
uniq | \
grep --invert-match $(git rev-parse $1))
if (( $(echo -n "$COMMITS" | wc -l) > 0 )); then
echo "$COMMITS" | xargs git show --stat
fi
@x3ro
x3ro / foo.sh
Created November 23, 2015 09:18
git submodule rewriting foo
git clone https://github.com/x3ro/automate sub &&
wget https://gist.githubusercontent.com/x3ro/6242017/raw/8fe69f096062f3f2b1858bcc816be5eb89d15535/git-rewrite-to-subfolder &&
chmod +x git-rewrite-to-subfolder &&
cd sub &&
../git-rewrite-to-subfolder
upstream gitlab {
server unix:/home/git/gitlab/tmp/sockets/gitlab.socket;
}
server {
listen 80 default_server;
server_name <change this to your FQDN>;
rewrite ^ https://$server_name$request_uri? permanent;
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains";
Hi Lucas.
I know that you have high-rated account on stackoverflow.
I want you to do a undelete vote for a very good and useful
question. It's really nice. I don't know why somebody deleted
it, but I want to revert it.
If you will do it, I will pay you $30 on your paypal account.
Or you can suggest another way of payment.
#!/usr/bin/env python
from __future__ import print_function
from optparse import OptionParser
import os
import sys
parser = OptionParser()
parser.add_option("-i", "--import", dest="imports", action="append", default=[],
@x3ro
x3ro / Makefile
Created September 12, 2013 12:44
Source files for my latest blog post on working with assembly routines and C on Mac OS X - http://x3ro.de/2013/09/12/link-assembly-routine-with-c-on-osx.html
all: run
run: clean test
./test
test: asm.o test.o
clang -o test asm.o test.o
asm64.o:
nasm -f macho64 asm.s
@x3ro
x3ro / gist:6274616
Last active December 21, 2015 07:58
draft.sx
Hello visitor. This is a fork of [@idan](https://github.com/idan)'s [gist.io](http://gist.io) project, adding a couple new features and fixing some bugs that have not been touched for a while. Idan intends to keep on working on the original gist.io, for which, at some point, he wants to charge a bit of money in order to even out the server costs ([source](https://github.com/idan/gistio/issues/55#issuecomment-22453283)), but he's currently unclear when that will be. At least until then, I will work on my own improvements, which might some day make it back into upstream :)
# Features added
## Callouts
> You can now use callouts, which are great to draw attention to specific, important sections of your text:
#!/bin/bash
# We need the TAB character for SED (Mac OS X sed does not understand \t)
TAB="$(printf '\t')"
function abort {
echo "$(tput setaf 1)$1$(tput sgr0)"
exit 1
}