This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def b64len(b64str): | |
""" | |
Calculate the length in bytes of a base64 string. | |
This function could decode the base64 string to a binary blob and count its | |
number of bytes with len(). But, that's inefficient and requires more | |
memory that really needed. | |
Base64 encodes three bytes to four characters. Sometimes, padding is added | |
in the form of one or two '=' characters. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run me with: | |
# python3 setup.py bdist_wheel --cythonize | |
# ... | |
if '--cythonize' in argv: | |
from Cython.Build import cythonize | |
packaging = { | |
'ext_modules': cythonize('lib/**/*.py'), | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
# Copyright (C) 2015-2017 Carlos Jenkins <carlos@jenkins.co.cr> | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!-- Generated with glade 3.22.1 --> | |
<interface> | |
<requires lib="gtk+" version="3.20"/> | |
<requires lib="vte-2.91" version="0.52"/> | |
<object class="GtkWindow" id="window"> | |
<property name="can_focus">False</property> | |
<signal name="delete-event" handler="stop" swapped="no"/> | |
<child> | |
<placeholder/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding:utf-8 -*- | |
# | |
# Copyright (C) 2013 Carlos Jenkins <carlos@jenkins.co.cr> | |
# | |
# 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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding:utf-8 -*- | |
# | |
# Copyright (C) 2013 Carlos Jenkins <carlos@jenkins.co.cr> | |
# | |
# 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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -o errexit | |
set -o nounset | |
# set -o xtrace | |
DOMAIN=${1:-} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Hierarchy is: | |
- GtkMenuBar | |
- GtkMenuItem | |
- GtkMenu | |
- GtkMenuItem | |
- GtkImageMenuItem | |
- GtkCheckMenuItem | |
- GtkRadioMenuItem | |
- GtkSeparatorMenuItem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# PARSING AN ISO8601 WITH OFFSET FORMATTED STRING USING A PYTHON VERSION PRIOR | |
# TO 3.7 WITH THE STANDARD LIBRARY ONLY | |
# | |
# | |
# For the formatting: | |
# | |
# This returns a datetime object with the timezone set to UTC. | |
# The internal time can now be interpreted as UTC. | |
# | |
# datetime.now(timezone.utc) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
// Compile with: | |
// gcc -std=c99 -g -Wall -O0 -o vg vg.c | |
// Run with: | |
// valgrind --leak-check=full ./vg [1|2|3] | |
int read_and_write(int* buff, int size, int seed) | |
{ |
NewerOlder