Skip to content

Instantly share code, notes, and snippets.

View Epillepsy's full-sized avatar

Osir Gueye Epillepsy

  • France
View GitHub Profile
@textarcana
textarcana / git-log2json.sh
Last active October 23, 2024 19:19
Convert Git logs to JSON. The first script (git-log2json.sh) is all you need, the other two files contain only optional bonus features 😀THIS GIST NOW HAS A FULL GIT REPO: https://github.com/context-driven-testing-toolkit/git-log2json
#!/usr/bin/env bash
# Use this one-liner to produce a JSON literal from the Git log:
git log \
--pretty=format:'{%n "commit": "%H",%n "author": "%aN <%aE>",%n "date": "%ad",%n "message": "%f"%n},' \
$@ | \
perl -pe 'BEGIN{print "["}; END{print "]\n"}' | \
perl -pe 's/},]/}]/'
@chrisbarrett
chrisbarrett / array_obj.h
Last active March 24, 2017 09:41
C object using blocks language extension
#include <assert.h>
#include <stdlib.h>
#define Array_new(name, type, len) \
typedef void(^name##_each)(type); \
typedef void(^name##_each_i)(type, int); \
\
struct { \
type *data; \
size_t length; \
@chrisbarrett
chrisbarrett / c_obj_usage.c
Last active March 24, 2017 09:41
C Array object usage example
#include <stdio.h>
#include "array_obj.h"
int main()
{
// Allocate an array of 5 ints.
Array_new(xs, int, 5);
// Initialize elements using their indices.
xs.each_i(^(int x, int i) { xs.set(i, i); });
// Print elements.
@jeffmcfadden
jeffmcfadden / IPCameraView.swift
Created July 2, 2014 22:48
A UIView Subclass For Displaying An IPCamera Stream (MJPEG)
class IPCameraView: UIView, NSURLSessionDataDelegate {
var imageView:UIImageView
var url: NSURL
var endMarkerData: NSData
var receivedData: NSMutableData
var dataTask: NSURLSessionDataTask
init(frame: CGRect) {