Skip to content

Instantly share code, notes, and snippets.

# Makefile template for a shared library in C
# https://www.topbug.net/blog/2019/10/28/makefile-template-for-a-shared-library-in-c-with-explanations/
CC = gcc # C compiler
CFLAGS = -fPIC -Wall -Wextra -O2 -g # C flags
LDFLAGS = -shared # linking flags
RM = rm -f # rm command
TARGET_LIB = libtarget.so # target lib
SRCS = main.c src1.c src2.c # source files
@tkqubo
tkqubo / html5TagSyntax.bnf
Last active April 23, 2024 01:49
EBNF notation for HTML5 tag syntax
tag-open := '<' tag-name ws* attr-list? ws* '>'
tag-empty := '<' tag-name ws* attr-list? ws* '/>'
tag-close := '</' tag-name ws* '>'
attr-list := (ws+ attr)*
attr := attr-empty | attr-unquoted | attr-single-quoted | attr-double-quoted
attr-empty := attr-name
attr-unquoted := attr-name ws* = ws* attr-unquoted-value
/*
* == Altered ==
* assign() is overloaded in c++. Changed assign(n, u) to
* assign_val(n, u);
*
* The insert and erase function use index instead of iterator
* to determine where stuff is inserted/erased
*
* == Not implemented ==
* any operator overloading, obviously
@sp3c73r2038
sp3c73r2038 / screenshot
Last active April 14, 2023 19:52
a script using ImageMagick to take screenshots
#!/bin/bash
DIR="${HOME}/images/screenshots"
DATE="$(date +%Y%m%d-%H%M%S)"
NAME="${DIR}/screenshot-${DATE}.png"
LOG="${DIR}/screenshots.log"
# Check if the dir to store the screenshots exists, else create it:
if [ ! -d "${DIR}" ]; then mkdir -p "${DIR}"; fi
@zoqaeski
zoqaeski / custom
Created October 12, 2012 18:14
xkbcomp keyboard layout dump
// $XDG_CONFIG_HOME/xkb/symbols/custom
// Makes ALT + CAPS_LOCK act as 3rd level switch
// Works sporadically
partial modifier_keys
xkb_symbols "alt_caps_mode_switch" {
key <CAPS> {
type[Group1]="PC_ALT_LEVEL2",
[ Caps_Lock, ISO_Level3_Shift ]
};
@chergert
chergert / dropline-status-icon.c
Created October 24, 2012 00:41
example for status icon
#include "dropline-status-icon.h"
G_DEFINE_TYPE(DroplineStatusIcon, dropline_status_icon, GTK_TYPE_STATUS_ICON)
struct _DroplineStatusIconPrivate
{
/*
* XXX: Put stuff you need during runtime here.
*/
gpointer dummy;
@40
40 / propertyalias.qml
Created November 9, 2012 07:26
passing data between qml pages - propertyalias.qml
import bb.cascades 1.0
Page {
property alias label5 : label5
Container {
layout: DockLayout {}
Label {
id: label5
text: "Hello World"
}
@xeoncross
xeoncross / Webserver.c
Created November 19, 2012 21:05
A web server in C language using only the standard libraries and thought it would be useful for you guys if I share the code. The server runs on Linux and includes features like handling HTTP GET request, handling content types(txt, html, jpg, zip. rar,
/*
* WebServer.c
*
* Created on: Nov 3, 2012
* Author: pavithra
*
* A web server in C language using only the standard libraries.
* The port number is passed as an argument.
*
* http://css.dzone.com/articles/web-server-c
@jasonm23
jasonm23 / template-theme.el
Created January 14, 2013 23:56
A very basic Emacs 24 deftheme template, just to show the main blocks to use.
;;; Filename: name-theme.el
(deftheme name
"DOCSTRING")
;; Not a bad idea to define a palette...
(let (
(color-1 "#ffffff")
(color-2 "#ff0000")
(color-3 "#00ff00")
(color-4 "#0000ff"))
@berlinbrown
berlinbrown / gist:4583728
Created January 21, 2013 05:05
Simplest Possible Web Crawler with C++
//============================================================================
// Name : OctaneCrawler.cpp
// Author : Berlin Brown (berlin dot brown at gmail.com)
// Version :
// Copyright : Copyright Berlin Brown 2012-2013
// License : BSD
// Description : This is the simplest possible web crawler in C++
// Uses boost_regex and boost_algorithm
//============================================================================