Skip to content

Instantly share code, notes, and snippets.

View keybase.md

Keybase proof

I hereby claim:

  • I am yoone on github.
  • I am yooone (https://keybase.io/yooone) on keybase.
  • I have a public key ASD0gN4QQFHy7KPFJh4ayVY0Zu0jVilmogjK_xK6_IqhGwo

To claim this, I am signing this object:

@Yoone
Yoone / endianness.c
Created Feb 25, 2018
Test endianness in C
View endianness.c
#include <stdio.h>
#include <stdint.h>
static inline uint8_t is_big_endian(void)
{
const uint16_t endian = 256;
return *(const uint8_t *)&endian;
}
int main(void)
@Yoone
Yoone / cpu-arch.c
Created Feb 25, 2018
Find out a machine's CPU architecture in C
View cpu-arch.c
#include <stdio.h>
int main(void)
{
/*
* AMD64
*/
#if defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64)
printf("AMD64\n");
@Yoone
Yoone / scala_pretty_obj.py
Created Feb 25, 2018
Pretty print Scala complex object structures printed by specs2
View scala_pretty_obj.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'Yoann Bentz'
__version__ = '1.0'
__email__ = 'yoann@yoone.eu'
import os
import sys
import tempfile
@Yoone
Yoone / django_mysql_dump.sh
Created Mar 4, 2017
Dump a Django project's MySQL database
View django_mysql_dump.sh
#!/usr/bin/env bash
set -euo pipefail
# Example usage in a crontab:
# 0 */6 * * * /path/to/djangoproject/django_mysql_dump.sh -d ~/mydumps
DEBUG=0
PYTHON_PATH=$(dirname "$0")
SETTINGS=djangoproject.settings