Browsed by
Month: December 2016

Advent Thought

Advent Thought

We all have deserts in our life. Deserts of loneliness, relationships that have grown cold or died, anger, fear, being stuck in a chronic sin, illness or physical pain, ignoring our relationship with God, selfishness, bad work situations – the deserts can be endless.

Advent is the time to open the doors of our desert to Christ so they can bloom. Not just for us, but for others around us that might be in their own deserts.

How can I open my deserts for Christ and bloom today?

Charity Giving at the End of the Year

Charity Giving at the End of the Year

As we enter the home stretch of the year and enter the Advent season, it’s a great time to volunteer, adopt a family, serve food or eat and visit with the homeless, and make some end of the year donations to charities as part of our preparation for Christmas.

If you want to support women, especially young, vulnerable women, during pregnancy, I would suggest a donation to the Fr. Taaffe Foundation. I’ve met Fr Taaffe and heard about the lives of many young women his group has helped over its 40 years and believe this is exactly the kind of support that really helps communities and stops unhealthy social cycles.

Reverend Monsignor Charles Taaffe began the Father Taaffe Foundation by opening the St. Brigid Home in 1975 in Keizer, Oregon. By 1990, Father realized that many more teenage mothers were keeping their babies and that there was a need for a home where young mothers could learn skills to help them succeed as single mothers.

Today, Catholic Community Services sustains Father’s vision as a nondenominational, nonprofit, charitable program, where homes and community-based supports provide structure, security, unconditional love and encouragement for single, pregnant and parenting teens.

Father Taaffe Homes are welcoming, comforting homes, inspiring hope for the future, self-confidence and independence. Certified by the State of Oregon and operated by Catholic Community Services, the homes provide young women, ages 12 to 20, a safe and nurturing environment from which to build their futures.

Through both residential and community-based services, expecting and young, single mothers gain knowledge and skills from prenatal care, to parenting, to running a household and creating healthy social connections for themselves and their babies. Those who come to live in a Father Taaffe Home are provided with basic amenities, including food, laundry facilities, access to local transportation, and computers to help with school work and job search.

Link for donations:
https://www.ccswv.org/home-page/childrenfamilies/father-taaffe-homes-and-pregnancy-support-services/

Module to cause linux kernel panic

Module to cause linux kernel panic

In doing some robustness testing, I needed to crash my Linux VM intentionally to see if the rest of the system survived. I was thinking of writing a kernel module that just did something silly like dereference null or divide by zero, but turns out you can do it much easier than that. Just call panic.

panic.c:
#define __NO_VERSION__
#include <linux/version.h>
#include 
#include 

int init_module(void)
{
    panic(" insert lame excuse here");
    return 0;
}

Build with:

 gcc -I/usr/src/linux/include -D__KERNEL__ -DMODULE -o panic.o -c panic.c

Here’s a good link about building kernel modules without full kernel source.

Now, run the following insmod, and your system will kernel panic.

 insmod panic.o 

Credit to Paul’s Journal

“Hello World” OpenGL on Linux

“Hello World” OpenGL on Linux

Writing the OpenGL context creation plumbing on Linux isn’t 100% intuitive. It’s always good to have a handy getting started guide. With developers increasingly using engines such as Unity, the number of people writing directly to OpenGL is shrinking – and so are some of the online resources to get over this initial step. I decided to collect a few links and copy critical sample code here for when I need to whip something up quickly.

 

Some links to good ‘hello world’ Linux GL samples:
https://github.com/jckarter/hello-gl
https://www.opengl.org/wiki/Tutorial:_OpenGL_3.0_Context_Creation_(GLX)
http://www-f9.ijs.si/~matevz/docs/007-2392-003/sgi_html/ch04.html

 

Code:
Taken from: https://www.opengl.org/sdk/docs/man2/xhtml/glXIntro.xml

Below is a minimal example of creating an RGBA-format X window that’s compatible with OpenGL using GLX 1.3 commands. The window is cleared to yellow when the program runs. The program does minimal error checking; all return values should be checked.

#include < stdio.h >
#include < stdlib.h >
#include < GL/gl.h >
#include < GL/glx.h >

int singleBufferAttributess[] = {
    GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
    GLX_RENDER_TYPE,   GLX_RGBA_BIT,
    GLX_RED_SIZE,      1,   /* Request a single buffered color buffer */
    GLX_GREEN_SIZE,    1,   /* with the maximum number of color bits  */
    GLX_BLUE_SIZE,     1,   /* for each component                     */
    None
};

int doubleBufferAttributes[] = {
    GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
    GLX_RENDER_TYPE,   GLX_RGBA_BIT,
    GLX_DOUBLEBUFFER,  True,  /* Request a double-buffered color buffer with */
    GLX_RED_SIZE,      1,     /* the maximum number of bits per component    */
    GLX_GREEN_SIZE,    1, 
    GLX_BLUE_SIZE,     1,
    None
};


static Bool WaitForNotify( Display *dpy, XEvent *event, XPointer arg ) {
    return (event->type == MapNotify) && (event->xmap.window == (Window) arg);
}
int main( int argc, char *argv[] )
{
    Display              *dpy;
    Window                xWin;
    XEvent                event;
    XVisualInfo          *vInfo;
    XSetWindowAttributes  swa;
    GLXFBConfig          *fbConfigs;
    GLXContext            context;
    GLXWindow             glxWin;
    int                   swaMask;
    int                   numReturned;
    int                   swapFlag = True;

    /* Open a connection to the X server */
    dpy = XOpenDisplay( NULL );
    if ( dpy == NULL ) {
        printf( "Unable to open a connection to the X servern" );
        exit( EXIT_FAILURE );
    }

    /* Request a suitable framebuffer configuration - try for a double 
    ** buffered configuration first */
    fbConfigs = glXChooseFBConfig( dpy, DefaultScreen(dpy),
                                   doubleBufferAttributes, &numReturned );

    if ( fbConfigs == NULL ) {  /* no double buffered configs available */
      fbConfigs = glXChooseFBConfig( dpy, DefaultScreen(dpy),
                                     singleBufferAttributess, &numReturned );
      swapFlag = False;
    }

    /* Create an X colormap and window with a visual matching the first
    ** returned framebuffer config */
    vInfo = glXGetVisualFromFBConfig( dpy, fbConfigs[0] );

    swa.border_pixel = 0;
    swa.event_mask = StructureNotifyMask;
    swa.colormap = XCreateColormap( dpy, RootWindow(dpy, vInfo->screen),
                                    vInfo->visual, AllocNone );

    swaMask = CWBorderPixel | CWColormap | CWEventMask;

    xWin = XCreateWindow( dpy, RootWindow(dpy, vInfo->screen), 0, 0, 256, 256,
                          0, vInfo->depth, InputOutput, vInfo->visual,
                          swaMask, &swa );

    /* Create a GLX context for OpenGL rendering */
    context = glXCreateNewContext( dpy, fbConfigs[0], GLX_RGBA_TYPE,
				 NULL, True );

    /* Create a GLX window to associate the frame buffer configuration
    ** with the created X window */
    glxWin = glXCreateWindow( dpy, fbConfigs[0], xWin, NULL );
    
    /* Map the window to the screen, and wait for it to appear */
    XMapWindow( dpy, xWin );
    XIfEvent( dpy, &event, WaitForNotify, (XPointer) xWin );

    /* Bind the GLX context to the Window */
    glXMakeContextCurrent( dpy, glxWin, glxWin, context );

    /* OpenGL rendering ... */
    glClearColor( 1.0, 1.0, 0.0, 1.0 );
    glClear( GL_COLOR_BUFFER_BIT );

    glFlush();
    
    if ( swapFlag )
        glXSwapBuffers( dpy, glxWin );

    sleep( 10 );
    exit( EXIT_SUCCESS );
}

 

Apple Bandit of Portland leaves amazing notes

Apple Bandit of Portland leaves amazing notes

Clark County sheriff’s deputies are hot on the trail of a man who has allegedly been chucking apples onto the roofs of unsuspecting residents and leaving some very odd notes in his wake. Law enforcement agencies around the Portland area have received periodic reports of so-called “apple-ing,” in which the fruits are maliciously tossed onto people’s homes. But even more interesting are the letters he leaves:

To The Good Citizens of Callisto,
I crossed the Rubicon River.
Today I did five houses. My backpack had fifteen apples in it, three apples per house. I pull up on my bike, take my backpack off, get the apples out, put the backpack back on, walk up a little closer and throw them high in the air over the house. The second and third apples are still in the air when the first one hits. Within seconds I am mounted up and gone.
Roofs are not created equally so the sound effects vary. It can be nothing, to a muted thump, to louder thumps to almost a crashing sound. I can remember one house. The owner must have had mason jars stacked up under the eaves; the apples came down on them like bowling bowls. I’ve broken a few windows but that happens rarely. If there are overhanging tree limbs or wires, I try to avoid hazards like that.
“Apple-ing” five houses takes about seven minutes. For a while I was doing eleven houses, that was down in the Richmond neighborhood. As it turns out eleven is too many as one night a police car showed up. The way he came was the way I went as he didn’t see me and I was surprised to see I was being followed by a Portland Fire SUV with four bicycles attached to the back. Now I heard that Portland Police were stepping up bicycle patrols in the wake of nuisance crimes. I took a right and a left, another right and a left and dropped down to Ladd’s Addition. So I started out at the Bagdad Theater and ended up in those nice gardens by the roundabout and there I lay down. I felt good being guarded by flowers.
It should be noted that the City of Portland might be the best place on earth for a hooligan riding a bicycle with a backpack filled with apples. There are bicyclists everywhere, even in the early morning hours. The neighborhoods are like corn fields, easy to get lost in.