This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Thanks to @danger89 and @Ilothar for updating the gist. | |
# Set the name and the supported language of the project | |
project(hello-world C CXX) | |
# Set the minimum version of cmake required to build this project | |
cmake_minimum_required(VERSION 3.10) | |
# Use the package PkgConfig to detect GTK+ headers/library files | |
find_package(PkgConfig REQUIRED) | |
pkg_check_modules(GTK REQUIRED gtkmm-3.0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w # camel code | |
use strict; | |
$_='ev | |
al("seek\040D | |
ATA,0, 0;");foreach(1..3) | |
{<DATA>;}my @camel1hump;my$camel; | |
my$Camel ;while( <DATA>){$_=sprintf("%-6 | |
9s",$_);my@dromedary 1=split(//);if(defined($ | |
_=<DATA>)){@camel1hum p=split(//);}while(@dromeda |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Simple MD5 implementation | |
* | |
* Compile with: gcc -o md5 -O3 -lm md5.c | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <stdint.h> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module MyList where | |
data MyList a = Cons a (MyList a) | |
| MyNil deriving (Show, Eq) | |
{- | |
A simple linked list module | |
Some examples: | |
mylist = (Cons 10 (Cons 99 (Cons 11 (Cons 1 MyNil)))) | |
myHead myList # => 10 | |
myTail myList # => Cons 99 (Cons 11 (Cons 1 MyNil)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <netinet/in.h> | |
#include <ev.h> | |
#include <strings.h> | |
#define PORT_NO 3033 | |
#define BUFFER_SIZE 1024 | |
void accept_cb(struct ev_loop *loop, struct ev_io *watcher, int revents); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define _XOPEN_SOURCE 700 | |
#include <signal.h> | |
#include <unistd.h> | |
int main() | |
{ | |
sigset_t set; | |
int status; | |
if (getpid() != 1) return 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//make font_transform_test CFLAGS=`freetype-config --cflags ` LDLIBS=`freetype-config --libs` LDLIBS+=`pkg-config fontconfig --libs` LDLIBS+='-lm' | |
/* | |
* Xpost - a Level-2 Postscript interpreter | |
* Copyright (C) 2013, Michael Joshua Ryan | |
* Copyright (C) 2013, Vincent Torri | |
* All rights reserved. | |
* | |
* Redistribution and use in source and binary forms, with or without | |
* modification, are permitted provided that the following conditions are met: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//compiled gcc fonttest.c -o fonttest -lfontconfig | |
//Sample output: /usr/share/fonts/steam-fonts/arial.ttf | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <fontconfig/fontconfig.h> | |
int main() | |
{ | |
FcConfig* config = FcInitLoadConfigAndFonts(); | |
//make pattern from font name | |
FcPattern* pat = FcNameParse((const FcChar8*)"Arial"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <SFML/Audio.h> | |
#include <SFML/Graphics.h> | |
int main() | |
{ | |
sfVideoMode mode = {800, 600, 32}; | |
sfRenderWindow* window; | |
sfTexture* texture; | |
sfSprite* sprite; | |
sfFont* font; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* $CC -o xresources_test xresources_test.c -lX11 */ | |
#include <X11/Xresource.h> | |
#include <string.h> | |
#include <stdio.h> | |
#define XRESOURCE_LOAD_STRING(NAME, DST) \ | |
XrmGetResource(db, NAME, "String", &type, &ret); \ | |
if (ret.addr != NULL && !strncmp("String", type, 64)) \ | |
DST = ret.addr; |
OlderNewer