Skip to content

Instantly share code, notes, and snippets.

View aerosol's full-sized avatar
🌞
Praise the sun

hq1 aerosol

🌞
Praise the sun
View GitHub Profile
@evadne
evadne / lecture.md
Last active October 4, 2023 23:24
How to Sell Elixir (2023)

How to Sell Elixir AGAIN (2023)

Presented by Evadne Wu at Code BEAM Lite in Stockholm, Sweden on 12 May 2023

Synopsis

We have celebrated 10 years of Elixir and also nearly 25 years of Erlang since the open source release in December 1998.

Most of the libraries that were needed to make the ecosystem viable have been built, talks given, books written, conferences held and training sessions provided. A new generation of companies have been built on top of the Elixir / Erlang ecosystem. In all measures, we have achieved further reach and maturity than 5 years ago.

EIO.inspect

Section

defmodule EIO do
  def inspect(input, opts \\ []) do
    {when_fn, opts} = Keyword.pop(opts, :when)

    if when_fn && not is_function(when_fn, 1) do
@bjesus
bjesus / config.json
Last active May 21, 2023 11:27
Khal indicator for Waybar
"custom/events": {
"format": "{}",
"tooltip": true,
"interval": 300,
"format-icons": {
"default": ""
},
"exec": "waybar-khal.py",
"return-type": "json"
},
@JoeyBurzynski
JoeyBurzynski / 55-bytes-of-css.md
Last active May 6, 2024 10:42
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@chshersh
chshersh / parser-combinators-vs-parser-generators.md
Last active June 12, 2023 11:06
Per criterion comparison of Parser Generators and Parser Combinators

Legend:

  • ➖ poor (impossible or very hard to achieve)
  • ➕ good (possible but requires some dancing)
  • ✔️ excellent (very easy to achieve/have)

PC stands for parser combinators and PGparser generators.

Property Generators Combinators Description
Power ✔️ LALR ➕ LL(∞) PC can't handle left-recursive grammars (though, there's some article¹...).
@ErikAugust
ErikAugust / spectre.c
Last active April 15, 2024 13:55
Spectre example code
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#ifdef _MSC_VER
#include <intrin.h> /* for rdtscp and clflush */
#pragma optimize("gt",on)
#else
#include <x86intrin.h> /* for rdtscp and clflush */
#endif
@aerosol
aerosol / otp.md
Last active November 14, 2017 07:39

Source: andOTP/andOTP#66

Hello, congratulations on such a nice OTP app. It has everything I want in an app, so I migrated my codes from FreeOTP to andOTP. I wrote a short script to do this.

To run the script, get the tokens.xml file from the FreeOTP directory on the phone, run the script with the filename as a parameter (./freeotp_migrate.py tokens.xml), and the script will output an andOTP-compatible plaintext JSON file. Just restore that and you're done.

Here's the script, released under the MIT license:

@hlorand
hlorand / xm_mod_it_TO_mp3.sh
Last active April 19, 2022 00:08
.xm .mod .it TO .mp3 converter bash script using VLC Media Player
#!/bin/bash
###########
# KEYGENMUSIC CONVERTER
###########
# This bash script converts every .xm .mod .it files to mp3 using VLC Media player
# Basically it supports every media format that VLC supports, and converts it to mp3
# if you comment out the file type checking line below.
# Usage:
#
@netmaniac
netmaniac / dht_sensor.h
Last active November 25, 2018 09:48
Simple air quality station - SDS011 + nodeMCU + DHT22 sending data to ThingSpeak. Project description (in Polish): http://starter-kit.nettigo.pl/2017/05/nodemcu-sds011-jako-badacz-jakosci-powietrza/ Code is free to use in own projects, but I don't provide any support nor don't make me liable if it is not working :)
// Example testing sketch for various DHT humidity/temperature sensors
// Written by ladyada, public domain
#include "DHT.h"
#define DHTPIN D7 // what digital pin we're connected to
// Uncomment whatever type you're using!
//#define DHTTYPE DHT11 // DHT 11
#define DHTTYPE DHT22 // DHT 22 (AM2302), AM2321
@kun-zhou
kun-zhou / calRemind.sh
Last active May 21, 2023 11:29
This script is used to fetch calendar entries from `khal` and set up reminders through `notify-send` 10 minutes ahead using `at` utility. It is supposed to be executed whenever your calendar update. If you use `vdirsyncer`, probably you would want run this script after running `vdirsyncer sync`
#!/usr/bin/bash
# The line below extracts the events in each line and add quotes to them so for loop will loop through each of them
items=`khal list today|tail -n +2 #no longer needed|awk -F"\n" '{printf("\"%s\"\n"),$1}'`
echo "$items"|while read -r rem # I pipe the list because otherwise the loop will treat blank space as delimiter
do
rm_time=$(($(date +%s --date "`echo $rem | sed -n 's/^\([0-9][0-9]:[0-9][0-9]\)-.*/\1:00/p'`") - 600)) # this command extracts the starting time of the event, and convert it to EPOCH, and subtract 10 minutes from it.
rm_time=`date +%H:%M --date @$rm_time` # This converts EPOCH back to human readble form
rem_name=`echo $rem | sed -n 's/.*:[0-9][0-9] \(.*\)/\1/p'`
echo "notify-send 'Calendar Reminder: $rem_name'" | at $rm_time today
done