Skip to content

Instantly share code, notes, and snippets.

View orymate's full-sized avatar

Máté Őry orymate

  • Budapest, Hungary
  • 13:41 (UTC +02:00)
View GitHub Profile
erlteszt :-
tryhelyese(0,true,s(2,
[[ [], [], [], []],
[ [], [], [], []],
[ [], [], [], []],
[ [], [], [], []]]),
[[2,3, 4,1],
[4,1, 2,3],
#!/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/"
@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
@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 / 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 / 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
#!/bin/bash
harmas ()
{
[ $1 -ge 3 ] && echo -n $(harmas $(expr $1 / 3))
echo -n $(expr $1 % 3)
}
harmas $1
echo
#!/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
TRACK=$1
OUT=$(mktemp)
curl "http://www.gramofon.nava.hu/data.php?n=1001&track=$TRACK" -s -L \
| sed -e 's/&/\&XXAMP;/g' \
-e 's/&XXAMP;amp;/\&amp;/g' \
-e 's/&XXAMP;/\&amp;/g' \
| iconv --from utf8 --to ascii//TRANSLIT \
> $OUT # ^mert xpath elkúrja \o/
@orymate
orymate / lcd.c
Created December 21, 2010 12:22
/* based on http://goo.gl/ArZG6 */
#define X )*2+1
#define _ )*2
#define s ((((((((0 /* 8 parens for 8 bit, 16 for 16, etc) */
unsigned char lcd_char_P[] =
{
s X X X X X X _ _,