Skip to content

Instantly share code, notes, and snippets.

@pazdera
pazdera / gist:1099562
Created July 22, 2011 14:30
Factory Method design pattern example in C++
/**
* Examlple of `factory method' 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:1086117
Created July 16, 2011 07:56
Example of using getopt(1) utility in bash
#!/bin/bash
# Example of using getopt(1) utility to parse script arguments
# 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 / abstract_factory_example.py
Created July 24, 2011 13:37
Example of `abstract factory' design pattern in Python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Example of `abstract factory' 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 / prototype.py
Created August 3, 2011 10:45
Example of `prototype' design pattern in Python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Example of `prototype' 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 / gist:1099559
Created July 22, 2011 14:29
Factory Method design pattern example in Python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Example of `factory method' 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 / 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 / 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 / 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 / prototype.cpp
Created August 3, 2011 10:36
Example of `prototype' design pattern in C++
/*
* Example of `prototype' 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 / brute_force_string.py
Created July 31, 2011 11:14
Brute-force string generation in Python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Brute-force string generation
# 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.