Skip to content

Instantly share code, notes, and snippets.

View orymate's full-sized avatar

Máté Őry orymate

  • Budapest, Hungary
  • 11:25 (UTC +02:00)
View GitHub Profile
#!/bin/bash
# Copyright 2009 ORY Mate <[email protected]> http://maat.orgo2002.hu
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
#!/bin/bash
harmas ()
{
[ $1 -ge 3 ] && echo -n $(harmas $(expr $1 / 3))
echo -n $(expr $1 % 3)
}
harmas $1
echo
@orymate
orymate / gist:846035
Created February 27, 2011 09:06
Mutt new mail indication in gnu screen
muttrc:
set status_format="/home/maat/run/bin/mutt_newmail '%b' '%n' '-%r-ubu: %f [Msgs:%?M?%M/?%m%? n? New:%n?%?o? Old:%o?%?d? Del:%d?%?F? Flag:%F?%?t? Tag:%t?%?p? Post:%p?%?b? Inc:%b?%?l? %l?]---(%s/%S)-%>-(% P)---'"|
/home/maat/run/bin/mutt_newmail:
#!/bin/bash
if [ "${1:-0}${2:-0}" = 00 ]
then
printf "\033kposta\033\\" > /dev/tty
@orymate
orymate / Makefile
Created March 27, 2011 10:28
glut makefile
nev=elso_hazi
LDFLAGS += -lglut -lGLU -lGL
#LDFLAGS += -m32 # 32 bites bináris
#CXXFLAGS += -m32 # 32 bites bináris
CXXFLAGS += -pedantic -Wall -Wextra
#CXXFLAGS += -DDEBUG -g # debug opciók
CXXFLAGS += -g0 -O3 # release opciók
@orymate
orymate / obj.awk
Created May 4, 2011 13:22
Wavefront obj file of polygon model to C++ converter
# http://en.wikipedia.org/wiki/Wavefront_.obj_file
$1 == "o" {
o++;
base[o] = vnum;
vnum_ = 0;
name[o] = $2;
}
$1 == "v" {
v[vnum++] = "Vec(" $2 "," $3 "," $4 ")";
vnum_ ++;
@orymate
orymate / ranges.sh
Created July 25, 2011 12:59
Print set of numbers as ranges
#!/bin/sh
sort -n | awk '
BEGIN { last = "x" }
/^[0-9]+$/ {
if (last == "x") {
range = $1
}
else if (last + 1 != int($1)) {
if (range != last){
printf "%d-%d\n", range, last
#!/bin/bash
ETC=/etc/nagios3/conf.d/
HGROUPS=/etc/nagios3/conf.d/hostgroups_nagios2.cfg
NMAPOPTS=''
# $1: hostname
# $2: group name
nagios-togroup () {
echo "/hostgroup_name[ \t][ \t]*$2/"
echo "/members/ s/$/,$1/"
erlteszt :-
tryhelyese(0,true,s(2,
[[ [], [], [], []],
[ [], [], [], []],
[ [], [], [], []],
[ [], [], [], []]]),
[[2,3, 4,1],
[4,1, 2,3],
@orymate
orymate / signal_name.c
Created March 6, 2012 14:08
signal_name.c
#include <signal.h>
const char *getsignalname(int n) {
static const char *names[NSIG];
static bool firstrun = true;
if (firstrun) {
firstrun = false;
names[SIGIOT ] = "SIGIOT";
names[SIGBUS ] = "SIGBUS";
names[SIGSTKFLT] = "SIGSTKFLT";
scp () {
for i in $*
do case $i in
*:*) command scp $*
return $?
esac
done
echo No remote path parameter. Aborting.
return 1
}