Skip to content

Instantly share code, notes, and snippets.

View Alexhuszagh's full-sized avatar

Alexander Huszagh Alexhuszagh

View GitHub Profile
@Alexhuszagh
Alexhuszagh / .vimrc
Created August 5, 2015 01:13
Vim RC
" URL: http://vim.wikia.com/wiki/Example_vimrc
" Authors: http://vim.wikia.com/wiki/Vim_on_Freenode
" Description: A minimal, but feature rich, example .vimrc. If you are a
" newbie, basing your first .vimrc on this file is a good choice.
" If you're a more advanced user, building your own .vimrc based
" on this file is still a good idea.
"------------------------------------------------------------
" Features {{{1
"
@Alexhuszagh
Alexhuszagh / Keybase.md
Created June 1, 2016 01:31
Keybase Declaration

Keybase proof

I hereby claim:

  • I am Alexhuszagh on github.
  • I am ahuszagh (https://keybase.io/ahuszagh) on keybase.
  • I have a public key whose fingerprint is E6B0 8BD5 B0A1 253A 5AA3 98E8 6592 5CF4 7A6D 8A24

To claim this, I am signing this object:

@Alexhuszagh
Alexhuszagh / shared_memory.py
Last active June 5, 2016 12:35
Shared Memory Access Numpy
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
'''
Demo for accessing a read-only shared array for high-performance
numpy workloads.
@Alexhuszagh
Alexhuszagh / md5.py
Last active June 18, 2016 20:44
Sampled MD5 Example
#!/usr/bin/env python
'''
Calculate an MD5sum from the file, sampling ``read`` bytes within the file from every ``interval``.
'''
import hashlib
PATH = 'path/to/file'
@Alexhuszagh
Alexhuszagh / generator.cpp
Last active June 24, 2016 20:38
Generator Function Example
/**
* @brief Sample coroutine function which uses recursion for it's
* evaluation.
*
* @copyright 2016, Alex Huszagh
* @license MIT
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@Alexhuszagh
Alexhuszagh / align_matrix.py
Created September 5, 2016 00:22
Align Matrix
'''
align_matrix
------------
Aligns two sturctures and prints the distance matrix (complete)
between the two aligned matrices.
:author: Alex Huszagh
:license: Unlicense, or MIT
'''
@Alexhuszagh
Alexhuszagh / samsung_to_silence.py
Last active October 4, 2016 19:29
Samsung to Silence SMS
#!/usr/bin/env python
'''
samsung_to_silence.py
---------------------
Convert Samsung SMS plaintext backups (XML) to the silence format.
:warning: This has only been tested with the Samsung Galaxy S6, other
systems may differ.
@Alexhuszagh
Alexhuszagh / widestream.cpp
Created October 10, 2016 18:11
Filestream with support for Windows wide API file names.
/** \brief FStream-like handle for Wide API support.
*
* Although the C standard makes no guarantees a C FILE descriptor will
* be used internally, both GCC and Clang do so, with GCC providing
* an extension to create a basic_filebuf from an existing C FILE or
* POSIX file descriptor[1]. As basic_fstream is merely a wrapper around
* basic_iostream with a basic_filebuf, this provides a full API
* that should have native performance.
*
* By using a GNU extension to solve a GNU-specific problem, or std::fstream
@Alexhuszagh
Alexhuszagh / embed_file.py
Created August 5, 2016 15:01 — forked from jlisee/embed_file.py
Convert a file to a C file to embedding in a C/C++ program
#! /usr/bin/env python
# Copyright (c) 2014, Joseph Lisee
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
@Alexhuszagh
Alexhuszagh / curl.c
Last active December 10, 2016 02:50
Lattice vs. cURL
#include <curl/curl.h>
#include <iostream>
int main(void)
{
CURL *curl;
CURLcode res;
curl_global_init(CURL_GLOBAL_ALL);