Skip to content

Instantly share code, notes, and snippets.

View d3cline's full-sized avatar
🎯
Focusing

John Spounias d3cline

🎯
Focusing
View GitHub Profile
@onecrayon
onecrayon / Makefile
Last active February 4, 2024 12:30
Load dotenv files into Make environment
# This is an example Makefile stub that demonstrates how to load variables from a dotenv file into
# your Make environment. Note that it isn't perfect; for instance, the double-quoted JSON string
# in the example file will probably not parse correctly because the escape characters will remain
# as part of the string when it is passed through Make, non-JSON multiline strings will cause the
# file to fail to parse with an obscure Make error, and some advanced features such as interpolation
# are not supported.
# I always start my Makefiles with this command, because then they're effectively self-documenting
help: cmd-exists-grep cmd-exists-sed
@grep -F -h "##" $(MAKEFILE_LIST) | grep -F -v @grep | sed -e 's/\\$$//' | sed -e 's/: [a-zA-Z0-9_][ a-zA-Z0-9_-]*[a-zA-Z0-9]\([[:space:]]*\)##/:\1##/' | sed -e 's/## //' -e 's/##//'
@onecrayon
onecrayon / base-emoji
Created January 29, 2024 23:06
BaseEmoji CLI
#!/usr/bin/env python3
"""BaseEmoji CLI
Inspired by this lovely little gem: https://github.com/amoallim15/base-emoji
But using something a little closer to the base64 algorithm (effectively base128, using emojis).
Comparison of a 13 character/13 byte string in two encodings:
$ base-64 <<< 'Hello, world!'
@maxvt
maxvt / hp-p1109w-on-ubuntu-1604.md
Last active February 22, 2019 22:48
Solution for a HP LaserJet P1109w not printing on Ubuntu 16.04 Xenial Xerus

As usual, Linux needs a bit of under-the-hood wrenching to get things working. HP is actually doing Linux support commendably compared to its peers (see hplip). However, in this case a bit of extra grease was needed.

Symptoms: Printer is detected automatically. A test page fails to print. CUPS logs say:

hp[14727]: io/hpmud/musb.c 2095: Invalid usb_open: Permission denied

Solution: Note that this will potentially mess up any HP scanners you have installed. If the P1109 is your only HP device, no problem. I do not claim this to be the correct, the most appropriate, or the

@olasd
olasd / stream_to_youtube.sh
Created March 28, 2014 19:58
Stream video to youtube via ffmpeg
#! /bin/bash
#
# Diffusion youtube avec ffmpeg
# Configurer youtube avec une résolution 720p. La vidéo n'est pas scalée.
VBR="2500k" # Bitrate de la vidéo en sortie
FPS="30" # FPS de la vidéo en sortie
QUAL="medium" # Preset de qualité FFMPEG
YOUTUBE_URL="rtmp://a.rtmp.youtube.com/live2" # URL de base RTMP youtube
@mkchandler
mkchandler / ReadSerialPort.cs
Created December 15, 2012 23:41
Some C# code to read a serial port. Using this as a starting point for an Arduino project.
using System;
using System.IO.Ports;
namespace SerialReader
{
class Program
{
static void Main(string[] args)
{
var reader = new ArduinoSerialReader("COM3");