Skip to content

Instantly share code, notes, and snippets.

View walchko's full-sized avatar

Kevin walchko

View GitHub Profile
@walchko
walchko / countdown.sh
Last active April 26, 2019 00:46
print unicode from bash 4
#!/usr/bin/env bash
# http://www.amp-what.com
# linux bash > 4.2 prints unicode
# printf "\U1f916 \n"
# echo -ne "\U1f916"
# robot face \U1f916
# hour glass \u23f3 different u
function countdown(){
# calc stop time
@walchko
walchko / anaglyph.py
Created March 23, 2019 17:10
Simple anaglyph example
#!/usr/bin/env python3
# https://en.wikipedia.org/wiki/Anaglyph_3D
# https://github.com/miguelgrinberg/anaglyph.py/blob/master/anaglyph.py
# MIT License Kevin Walchko 2018
import numpy as np
import cv2
# declare various color blending algorithms to mix te pixels
# from different perspectives so that red/blue lens glasses
{
"namespace": "example.avro",
"type": "record",
"name": "User",
"fields": [
{"name": "name", "type": "string"},
{"name": "favorite_number", "type": ["int", "null"]},
{"name": "favorite_color", "type": ["string", "null"]}
]
}
@walchko
walchko / fork-ex.cpp
Last active February 10, 2019 19:10
Example using fork
#include <stdio.h>
#include <iostream>
#include <unistd.h> // sleep
#include <sys/types.h> // pid (type int)
#include <csignal> // signals
#include <vector>
using namespace std;
void sigHandler(int signo)
@walchko
walchko / args.cpp
Last active February 11, 2019 12:47
create fake c++ command line args in c++11
// c++11 doesn't like conversion from string to char*
// https://stackoverflow.com/a/14470318/5374768
int main(){
int argc = 4;
char* argv[] =
{
(char*)("./main"),
(char*)("--type"),
(char*)("Finishing"),
@walchko
walchko / CMakeLists.txt
Created December 29, 2018 18:10
Simple pub/sub zmq
cmake_minimum_required(VERSION 3.6)
project(test)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# ZeroMQ ----------------------------------------------------------
# https://github.com/zeromq/cppzmq
include_directories(zmq)
@walchko
walchko / toallemployees.md
Created December 9, 2018 22:02 — forked from marsam/toallemployees.md
TO ALL EMPLOYEES

TO ALL EMPLOYEES

It has been brought to the management’s attention that some individuals have been using foul language in the course of normal conversation between employees. Due to complaints from some of the easily offended workers, this conduct will no longer be tolerated.

The management does, however, realize the importance of each person being able to properly express their feelings when communicating with their fellow employees. Therefore, the management has compiled the following code phrases so that the proper exchange of ideas and information can continue.

OLD PHRASE                                               NEW PHRASE

No fucking way ......................................... I’m not certain that’s feasible.

You’ve got to be shitting me ........................... Really.

@walchko
walchko / downloadPDFs.py
Created November 19, 2018 17:58 — forked from royshil/downloadPDFs.py
Download All PDFs in a URL using Python mechanize
# This is kind-of based off of this: http://stackoverflow.com/questions/5974595/download-all-the-linksrelated-documents-on-a-webpage-using-python
import cookielib
import urllib2
import mechanize
from time import sleep
import os
import cgi
# A routine to download a file from a link, by simulating a click on it
@walchko
walchko / CMakeLists.txt
Created October 6, 2018 15:39
python3.7 and ctypes
cmake_minimum_required(VERSION 3.4)
# references
# https://stackoverflow.com/questions/17511496/how-to-create-a-shared-library-with-cmake
# https://stackoverflow.com/questions/51451124/python-2-7-c-extensions-with-cmake-and-setuptools
project(mylib VERSION 1.0.0 DESCRIPTION "test")
set(CMAKE_CXX_STANDARD 14)
set(DEFAULT_BUILD_TYPE "Release")
@walchko
walchko / shm-consumer.c
Created October 3, 2018 03:49
posix shared memory
/**
* Simple program demonstrating shared memory in POSIX systems.
*
* This is the consumer process
*
* Figure 3.18
*
* @author Gagne, Galvin, Silberschatz
* Operating System Concepts - Ninth Edition
* Copyright John Wiley & Sons - 2013