Skip to content

Instantly share code, notes, and snippets.

View nega0's full-sized avatar
🌴
I may be slow to respond.

nega nega0

🌴
I may be slow to respond.
View GitHub Profile
--- /dev/null 2015-09-14 09:02:32.937677367 -0400
+++ Makefile 2015-09-18 12:14:24.000000000 -0400
@@ -0,0 +1,36 @@
+CC=gcc
+CFLAGS=$(FFLAGS)
+OSNAME=$(shell uname -s)
+
+all: lib-shared
+
+tpythia6_called_from_cc.o:
--- /dev/null 2010-03-17 10:23:05.304266802 -0400
+++ main.c 2010-03-18 15:26:14.000000000 -0400
@@ -0,0 +1 @@
+void MAIN__() {}
--- /dev/null 2011-01-28 15:18:26.820752001 +0100
+++ pythia6_rng_callback.c 2011-02-03 21:35:13.542831166 +0100
@@ -0,0 +1,24 @@
+/* forward decl, original Pythia impl */
+extern double old_pyr_(int* idummy);
+
+/* function pointer contating the current impl */
+double (*pyr_callback)(int*) = 0;
+
+/* setter for the pyr callback */
--- pythia6416.f.orig 2008-03-14 09:37:15.000000000 +0100
+++ pythia6416.f 2011-02-03 20:03:16.622831025 +0100
@@ -70354,8 +70354,24 @@
C...PYR
C...Generates random numbers uniformly distributed between
C...0 and 1, excluding the endpoints.
+C...Calls back to an externally defined function EXT_PYR
FUNCTION PYR(IDUMMY)
+ DOUBLE PRECISION PYR, EXT_PYR
@nega0
nega0 / syslog.py
Last active June 3, 2022 02:55
a simple "syslog" lexer for pygments
## a simple "syslog" lexer for pygmentize
from pygments.lexer import RegexLexer, bygroups
from pygments.token import *
__all__ = ['SyslogLexer']
class SyslogLexer(RegexLexer):
name = 'Syslog'
aliases = ["syslog"]
@nega0
nega0 / snap.sh
Created March 24, 2016 21:06
bash script to "snap" the current terminal emulator to an aspect ratio
#!/bin/bash
## bash script to "snap" the current terminal emulator to an aspect
## ratio maintaining either the width or the height. note that your
## terminal will actually snap to the closest size that has no
## partial character cells
ar="16/10" ## set your aspect ratio here
ar=$(bc -l <<< "$ar")
## This macro takes 2 arguments. The first, _d, is an "integer date"
## in the format of "YYYYmmdd". The second, _m, is a message that will
## be passed to message(WARNING ...) or message(FATAL_ERROR ...). A
## one line message is recomended.
##
## It is recomended that you provide some explanitory warning prior to
## calling this macro.
## An example follows ...
@nega0
nega0 / iptables_color.txt
Last active September 26, 2023 23:56
colorize your `iptables` output
## based on the blogpost here: http://blog.sjas.de/posts/colored-iptables-output.html
iptables --line-numbers -vnL |\
sed -E 's/^Chain.*$/\x1b[4m&\x1b[0m/' |\
sed -E 's/^num.*/\x1b[33m&\x1b[0m/' |\
sed -E '/([^y] )((REJECT|DROP))/s//\1\x1b[31m\3\x1b[0m/' |\
sed -E '/([^y] )(ACCEPT)/s//\1\x1b[32m\2\x1b[0m/' |\
sed -E '/([ds]pt[s]?:)([[:digit:]]+(:[[:digit:]]+)?)/s//\1\x1b[33;1m\2\x1b[0m/' |\
sed -E '/([[:digit:]]{1,3}\.){3}[[:digit:]]{1,3}(\/([[:digit:]]){1,3}){0,1}/s//\x1b[36;1m&\x1b[0m/g' |\
sed -E '/([^n] )(LOGDROP)/s//\1\x1b[33;1m\2\x1b[0m/'|\
@nega0
nega0 / iptables_color_with_grc.txt
Last active June 29, 2017 18:11
colorize `iptables` with grc
## based on https://gist.github.com/nega0/1d232622a1fa3dad176869bbfe747602
## conf file for https://github.com/garabik/grc
## put in ~/.grc/conf.iptables
# chain section headers
regexp=^Chain.*
colors=underline
=======
# column headers
regexp=^num.*
@nega0
nega0 / svnhacks.sh
Last active November 11, 2019 21:28 — forked from scrooloose/svnhacks.sh
This script hijacks calls to svn and adds color and pagination to some svn commands. Source it from your ~/.zshrc.
#Author: Martin Grenfell [http://github.com/scrooloose]
#License:
#
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/wtfpl/COPYING for more details.
#
#This script hijacks calls to svn and adds color and pagination to