Skip to content

Instantly share code, notes, and snippets.


Oktawian Chojnacki ochococo

View GitHub Profile
ochococo /
Last active Aug 1, 2020
National Instruments GPIB-USB-HS via PyVISA on

National Instruments GPIB-USB-HS + PYVISA on Ubuntu


Install depedencies:

sudo apt-get install tk-dev build-essential texinfo texi2html libcwidget-dev libncurses5-dev libx11-dev binutils-dev bison flex libusb-1.0-0 libusb-dev libmpfr-dev libexpat1-dev tofrodos subversion autoconf automake libtool mercurial

Keybase proof

I hereby claim:

  • I am ochococo on github.
  • I am oktawian ( on keybase.
  • I have a public key ASB7VROLCN9EwfGwa45NwbVelCxE7kXhZHI47BQrPxhWpwo

To claim this, I am signing this object:

ochococo / gist:7e8a5493b5ffa9d4fc10
Last active Aug 29, 2015
Swift, Builder discussion.
View gist:7e8a5493b5ffa9d4fc10

Answer to: (

  • Is fluent:
  • Is pretty:

This example (and approach) is too simple to start discussion about Builder.


  • Initializer interface supports encapsulation and any implementation changes: 💩
View OEternal.h
// OEternal
// Created by Oktawian Chojnacki on 30.11.2013.
#import <Foundation/Foundation.h>
@interface NSObject (OEternal)
View gist:6202274
if [[ $COLORTERM = gnome-* && $TERM = xterm ]] && infocmp gnome-256color >/dev/null 2>&1; then
export TERM=gnome-256color
elif infocmp xterm-256color >/dev/null 2>&1; then
export TERM=xterm-256color
View gist:6202267
# Load ~/.extra, ~/.bash_prompt, ~/.exports, ~/.aliases, and ~/.functions
# ~/.extra can be used for settings you don’t want to commit
for file in ~/.{extra,bash_prompt,exports,aliases,functions}; do
[ -r "$file" ] && source "$file"
unset file
# Case-insensitive globbing (used in pathname expansion)
shopt -s nocaseglob
ochococo / gist:6159632
Created Aug 5, 2013
Encrypting and Decrypting NSData with AES256
View gist:6159632

Encrypting and Decrypting NSData with AES256

(possibly not very safe - no IV vector)

- (NSData*)aes256EncryptWithKey:(NSString*)key
    // 'key' should be 32 bytes for AES256, will be null-padded otherwise
    char keyPtr[kCCKeySizeAES256 + 1];
    bzero( keyPtr, sizeof( keyPtr ) );
ochococo / gist:6159588
Created Aug 5, 2013
Calculating NSData’s MD5
View gist:6159588

Calculating NSData’s MD5

- (NSString*)md5
    unsigned char result[16];
    CC_MD5( self.bytes, self.length, result ); // This is the md5 call
    return [NSString stringWithFormat:@"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
            result[0], result[1], result[2], result[3], 
            result[4], result[5], result[6], result[7],
ochococo / gist:6158319
Last active Dec 20, 2015
Waiting until two async blocks are executed (Obj-C)
View gist:6158319

Waiting until two async blocks are executed (Obj-C)

This allows to dispatch a block, on Main Thread, once two async operations are completed.

dispatch_group_t group = dispatch_group_create();

dispatch_group_async(group, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^ {
[NSThread sleepForTimeInterval:5.0];
View gist:6152300

GIT Modules

Equivalent to SVN Externals, GIT offers a nice feature called “Modules”. Long short story, you get to link an external project, inside your own project.

What do you make out of this?. Well, suppose you’re using a 3rd party library. You can update everything with just a command line pull. No need to download and merge, by hand. Sounds nice, right?. It’s done this way:

cd MyApp
git submodule add git:// Frameworks/SomeFramework
You can’t perform that action at this time.