Skip to content

Instantly share code, notes, and snippets.

@pazdera
pazdera / github-release.sh
Created October 17, 2018 17:06
Create a github release for an existing tag from the command line
#!/usr/bin/env bash
# https://developer.github.com/v3/repos/releases/#create-a-release
repo=$1
tag=$2
name=$3
text=$4
token=$GH_TOKEN
@pazdera
pazdera / yardoc-cheatsheet.rb
Last active November 5, 2016 02:35
Basic Yard Syntax (contributions welcome)
# Quick summary of the function
#
# {ObjectName#method Optional Title}
# {Class::CONSTANT Optional Title}
# {#method_inside_current_namespace}
#
# @see #method
#
# @param one [Fixnum] First parameter
# @param two [Fixnum] Second parameter
@pazdera
pazdera / dirstat.c
Created October 14, 2012 21:35
getdents + stat
/* getdents() + stat() scenario
*
* This program is based on an example from linux man page getdents(2)
*/
#define _GNU_SOURCE
#include <dirent.h> /* Defines DT_* constants */
#include <fcntl.h>
#include <stdio.h>
@pazdera
pazdera / limits.c
Created February 15, 2012 21:09
Size of some integer types
/* Integer types -- sizes */
#include <stdio.h>
#include <stdint.h>
int main(void)
{
printf("int bytes: %d\n", sizeof(int));
printf("uint32_t bytes: %d\n", sizeof(uint32_t));
@pazdera
pazdera / bridge.py
Created August 26, 2011 08:54
Example of `bridge' design pattern in Python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Example of `bridge' design pattern
# This code is part of http://wp.me/p1Fz60-8y
# Copyright (C) 2011 Radek Pazdera
# 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
@pazdera
pazdera / bridge.cpp
Created August 15, 2011 19:13
Example of `bridge' design pattern in C++
/*
* Example of `bridge' design pattern
* Copyright (C) 2011 Radek Pazdera
* 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,
@pazdera
pazdera / gist:1146033
Created August 15, 2011 10:56
References for Wordpress.com
<!-- Reference -->
<sup>[<a href="#sources">1</a>]</sup>
<!-- Sources -->
<h2 id="sources">Sources</h2>
<ol>
<li>ref</li>
</ol>
@pazdera
pazdera / adapter.py
Created August 15, 2011 07:38
Example of `adapter' design pattern in Python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Example of `adapter' design pattern
# Copyright (C) 2011 Radek Pazdera
# 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.
@pazdera
pazdera / adapter.cpp
Created August 15, 2011 07:37
Example of `adapter' design pattern in C++
/*
* Example of `adapter' design pattern
* Copyright (C) 2011 Radek Pazdera
* 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,
@pazdera
pazdera / object_pool.py
Created August 4, 2011 09:33
Example of `object pool' design pattern in Python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Example of `object pool' design pattern
# Copyright (C) 2011 Radek Pazdera
# 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.