Skip to content

Instantly share code, notes, and snippets.

@xorg62
xorg62 / gist:3724352
Created September 14, 2012 20:00
Ncurses Conway's game of life
/*
* /\___/\
* ) ( Conway's Game of life
* =\ /=
* ) (
* / \ by xorg62 <xorg62@gmail.com>
* ( )
* / \
* \ / This software is under BSD license.
* \__ _/
/*
* hftirc2 by Martin Duquesnoy <xorg62@gmail.com>
* For license, see COPYING
*/
#ifndef HFTIRC_H
#define HFTIRC_H
#define_XOPEN_SOURCE_EXTENDED 1
/*
* hftirc2 by Martin Duquesnoy <xorg62@gmail.com>
* For license, see COPYING
*/
#ifndef HFTIRC_H
#define HFTIRC_H
#define_XOPEN_SOURCE_EXTENDED 1
@xorg62
xorg62 / status.c
Created February 21, 2012 12:39
Very light status for WMFS² written in C.
/*
* status.c for WMFS²
* xorg62
* cc status.c -lX11 -lmpdclient -o status
*/
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* Get client with x/y position on root window */
Client*
get_client_with_pos(int x, int y)
{
Client *c;
Window w;
int d, dx, dy, basex, basey;
if(x < 1 || x > sgeo[selscreen].width
|| y < 1 || y > sgeo[selscreen].height)
static void
tile_factor_set(Client *c, Position p, int fac)
{
Client *gc = NULL;
int x, y;
XRectangle cgeo, scgeo;
char scanfac[4][3] =
{
{ 1, 0 }, { -1, 0 }, /* Right, Left */
{ 0, -1 }, { 0, 1 } /* Top, Bottom */
static void
tile_factor_set(Client *c, Position p, int fac)
{
Client gc = NULL;
int cpos, i, x, y;
char scanfac[4][2] =
{
{ 1, 0 }, { -1, 0 }, /* Right, Left */
{ 0, -1 }, { 0, 1 } /* Top, Bottom */
};