Skip to content

Instantly share code, notes, and snippets.

View arl's full-sized avatar
🎧

Aurélien Rainone arl

🎧
View GitHub Profile
@sinewalker
sinewalker / _gitmux_filter.sh
Last active September 1, 2022 07:36
gitmux filter to replace 'origin' with a symbol for the git host.
#!/usr/bin/env bash
# Wrapper for gitmux to change some strings in ways that it doesn't
# allow for. Also replace 'origin' with a symbol for the git host.
WORKING_COPY=${1}
[[ -d ${WORKING_COPY} ]] || exit 1
pushd $WORKING_COPY &> /dev/null
STATUS=$(git status) &> /dev/null || exit 2
URL=$(git config --get remote.origin.url) &> /dev/null
if [[ "${STATUS}" =~ "No commits yet" ]] ; then
@egonelbre
egonelbre / architecture.md
Last active January 7, 2023 02:33
Gio architecture brain-dump
title
Architecture

Introduction

Gio implements an Immediate Mode User Interface.. This approach can be implemented in multiple ways, however the overarching similarity is that the program:

  1. listens for events such as mouse or keyboard input,
@chmike
chmike / sliceDump.go
Last active June 3, 2024 21:58
Go language function to dump a byte slice in hexadecimal and ASCII
func dumpByteSlice(b []byte) {
var a [16]byte
n := (len(b) + 15) &^ 15
for i := 0; i < n; i++ {
if i%16 == 0 {
fmt.Printf("%4d", i)
}
if i%8 == 0 {
fmt.Print(" ")
}
@zed-dz
zed-dz / offline_mdn_docs.md
Created March 12, 2019 14:01
Offline MDN Docs
@rueycheng
rueycheng / GNU-Make.md
Last active July 6, 2024 14:14
GNU Make cheatsheet
@reklis
reklis / Example.cpp
Created September 15, 2015 19:40
reliability-and-flow-control
/*
Reliability and Flow Control Example
From "Networking for Game Programmers" - http://www.gaffer.org/networking-for-game-programmers
Author: Glenn Fiedler <gaffer@gaffer.org>
*/
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
@mattes
mattes / check.go
Last active June 12, 2024 19:31
Check if file or directory exists in Golang
if _, err := os.Stat("/path/to/whatever"); os.IsNotExist(err) {
// path/to/whatever does not exist
}
if _, err := os.Stat("/path/to/whatever"); !os.IsNotExist(err) {
// path/to/whatever exists
}
@ccbrown
ccbrown / DumpHex.c
Last active March 27, 2024 17:32
Compact C Hex Dump Function w/ASCII
#include <stdio.h>
void DumpHex(const void* data, size_t size) {
char ascii[17];
size_t i, j;
ascii[16] = '\0';
for (i = 0; i < size; ++i) {
printf("%02X ", ((unsigned char*)data)[i]);
if (((unsigned char*)data)[i] >= ' ' && ((unsigned char*)data)[i] <= '~') {
ascii[i % 16] = ((unsigned char*)data)[i];
'use strict';
/**
* Mobiscroll directives set
* @type {*}
*/
var mobiscroll = angular.module('mobiscroll', []);
/*
* Native style datetime picker
*/
@ksafranski
ksafranski / expecting.md
Last active November 11, 2023 23:00
Basic principles of using tcl-expect scripts

Intro

TCL-Expect scripts are an amazingly easy way to script out laborious tasks in the shell when you need to be interactive with the console. Think of them as a "macro" or way to programmaticly step through a process you would run by hand. They are similar to shell scripts but utilize the .tcl extension and a different #! call.

Setup Your Script

The first step, similar to writing a bash script, is to tell the script what it's executing under. For expect we use the following:

#!/usr/bin/expect