Skip to content

Instantly share code, notes, and snippets.

View fullofcaffeine's full-sized avatar

Marcelo Serpa fullofcaffeine

View GitHub Profile
@suuuehgi
suuuehgi / 001evaluation.svg
Created February 4, 2018 15:58 — forked from Artefact2/00considerations.md
Borg compression benchmark/comparison
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kevinresol
kevinresol / Wiper.hx
Created January 20, 2018 02:37
Client side API Wiper for tink_web
package api;
// to use: add `implements api.Wiper` to your API class
// but it doesn't handle imports, either you use wildcard (import api.*) or guard them with `#if`
#if macro
import haxe.macro.Context;
using tink.MacroApi;
#end
@jdonaldson
jdonaldson / Config.hx
Last active May 24, 2019 17:34
Utility Classes for Haxe
using haxe.macro.Context;
import haxe.macro.Expr;
/**
Simple config merge routine. Supply a series of anonymous objects, and this macro will merge them into a single instance.
This is useful for providing a series of overrides for config, so I've gone with that name.
The benefit is that the macro preserves all of the typing info, so you still get completions, etc. on the merged object.
**/
class Config {
public static macro function merge<T>(arr : Array<ExprOf<T>>) : Expr {
@lleqsnoom
lleqsnoom / Shell.hx
Created September 21, 2017 14:06
haxe linux/mac shell commands with pipes
package;
import sys.io.Process;
using StringTools;
class Shell
{
public static function main() {
trace(exec('ioreg -c IOSerialBSDClient | grep usbmodem | grep IODialinDevice | cut -d " -f 4'));
}
@luispabon
luispabon / borg-backup.sh
Last active February 16, 2018 06:09
Encrypted borg backup to s3 of home folder
#!/bin/bash
# NOTE: decided to actually make a more reusable version with README and all, to be found at
# this repo: https://github.com/luispabon/borg-s3-home-backup
@haxiomic
haxiomic / Partial.hx
Last active February 26, 2023 11:44
Haxe macro to make all fields of a type optional (similar to Typescript's Partial<T>)
import haxe.macro.Context;
import haxe.macro.Expr;
import haxe.macro.TypeTools;
#if !macro
@:genericBuild(PartialMacro.build())
#end
class Partial<T> {}
class PartialMacro {
@Fuco1
Fuco1 / org-archive-subtree.el
Created October 30, 2016 13:12
Archive subtrees under the same hierarchy as original in the archive files.
(defadvice org-archive-subtree (around fix-hierarchy activate)
(let* ((fix-archive-p (and (not current-prefix-arg)
(not (use-region-p))))
(afile (org-extract-archive-file (org-get-local-archive-location)))
(buffer (or (find-buffer-visiting afile) (find-file-noselect afile))))
ad-do-it
(when fix-archive-p
(with-current-buffer buffer
(goto-char (point-max))
(while (org-up-heading-safe))
@RealyUniqueName
RealyUniqueName / KeyValueIterator.hx
Last active October 14, 2016 10:35
Key-value map iterator
class KeyValueIterator<K,V> {
var map:Map<K,V>;
var keys:Iterator<K>;
static public inline function pairs<K,V>(map:Map<K,V>) return new KeyValueIterator(map);
public inline function new(map:Map<K,V>) {
this.map = map;
this.keys = map.keys();
}
@daronco
daronco / letsencrypt-webroot-apache.md
Last active February 15, 2024 11:50
Letsencrypt with webroot on Apache

Config Apache with /etc/apache2/conf-available/le.conf:

Alias /.well-known/acme-challenge/ "/var/www/html/.well-known/acme-challenge/"
<Directory "/var/www/html/">
    AllowOverride None
    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
    Require method GET POST OPTIONS
</Directory>