Skip to content

Instantly share code, notes, and snippets.

View glejeune's full-sized avatar

Gregoire Lejeune glejeune

View GitHub Profile
@glejeune
glejeune / rocketguide.md
Created March 26, 2020 23:03 — forked from belst/rocketguide.md
Deploy Rocket in production

Deploy Rocket using Letsencrypt and nginx

Information

This guide uses the domain your-domain.tld and its www. prefixed version. It starts the rocket application on 127.0.0.1:1337 and as the user www-data. The proxy listens on port 80 and 443 though.
If you need other values, update them accordingly in your nginx and systemd configs.

Prerequisites

You need to have nginx, certbot and rust installed.

@glejeune
glejeune / README.md
Created March 13, 2020 23:01 — forked from zoilomora/README.md
How to disable systemd-resolved in Ubuntu

How to disable systemd-resolved in Ubuntu

Stages

  • Disable and stop the systemd-resolved service:

      sudo systemctl disable systemd-resolved.service
      sudo systemctl stop systemd-resolved
    
  • Then put the following line in the [main] section of your /etc/NetworkManager/NetworkManager.conf:

Keybase proof

I hereby claim:

  • I am glejeune on github.
  • I am glejeune (https://keybase.io/glejeune) on keybase.
  • I have a public key ASCOfHi10nVD7yaNQBeZpEoifx74zJpPDIBBbsSnlqaqWQo

To claim this, I am signing this object:

@glejeune
glejeune / message.erl
Created June 26, 2017 08:03
Fun with message...
-module(message).
-export([decode/3, decode/4, encode/1]).
decode(M1, M2, M3) ->
decode(M1, M2, M3, float_to_integer(length(M1)/8 - 1)).
decode(M1, M2, M3, Size) ->
[L1, L2, L3] = [[list_to_integer(string:substr(M, I*8+1, 8), 2) || I <- lists:seq(0, Size)] || M <- [M1, M2, M3]],
[A bxor B bxor C || {A, B, C} <- lists:zip3(L1, L2, L3)].
@glejeune
glejeune / xml_parser.sh
Last active October 10, 2023 09:45
A simple XML parser for sh, zsh, bash, ...
#!/bin/sh
# This script is a very naive XML parser for sh
# ...
# This fontion is called once for each file. It initialize the parser
#
# Type: private
# Parameters:
@glejeune
glejeune / gist:4131931
Created November 22, 2012 16:18
C/C++ useful macros
#define CONCATENATE(arg1, arg2) arg1##arg2
#define IN_NARG(...) IN_NARG_(__VA_ARGS__, IN_RSEQ_N())
#define IN_NARG_(...) IN_ARG_N(__VA_ARGS__)
#define IN_ARG_N(_1, _2, _3, _4, _5, _6, _7, _8, _9, N, ...) N
#define IN_RSEQ_N() 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
#define IN_1(x, v, ...) ((v) == (x))
#define IN_2(x, v, ...) ((v) == (x)) || IN_1(x, __VA_ARGS__)
#define IN_3(x, v, ...) ((v) == (x)) || IN_2(x, __VA_ARGS__)
@glejeune
glejeune / extractDMG.sh
Created January 5, 2012 19:12
Extract DMG on MacOSX
#!/bin/sh
usage() {
echo "$0 /path/to/image.dmg [/output/path]"
exit 0
}
DMG=$1
OUTPUT=$2
@glejeune
glejeune / id3editor.rb
Created December 16, 2011 21:20
My simple ID3v2 tag editor
#!/usr/bin/ruby
require 'rubygems'
require 'mp3info'
require 'readline'
TAGS = {
"AENC" => "Audio encryption",
"APIC" => "Attached picture",
"COMM" => "Comments",
@glejeune
glejeune / markdown_viewer.rb
Created December 9, 2011 14:18
A tiny Markdown Viewer with Ruby/Gtk
#!/usr/bin/env ruby
require 'tempfile'
require 'rubygems'
require 'gtkmozembed'
require 'markdown'
class MarkdownViewer < Gtk::Window
def initialize(file)
super
@glejeune
glejeune / foobarqix.sh
Created November 25, 2011 11:52
Yet another FooBarQix solution
#!/bin/sh
_() {
[ $(expr $V % $1) == 0 ] && R=$(echo $R$2)
}
foobarqix() {
_ 3 "Foo";_ 5 "Bar";_ 7 "Qix"
R=$(echo $R$V | sed -e 's/3/Foo/g' | sed -e 's/5/Bar/g' | sed -e 's/7/Qix/g' | sed -e 's/[0-9]//g')
[ "Z$R" == "Z" ] && R=$V
}