Skip to content

Instantly share code, notes, and snippets.

Avatar

Gregoire Lejeune glejeune

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

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 Mar 13, 2020 — forked from zoilomora/README.md
How to disable systemd-resolved in Ubuntu
View README.md

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:

View keybase.md

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 Jun 26, 2017
Fun with message...
View message.erl
-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 Aug 19, 2019
A simple XML parser for sh, zsh, bash, ...
View xml_parser.sh
#!/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 Nov 22, 2012
C/C++ useful macros
View gist:4131931
#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 Jan 5, 2012
Extract DMG on MacOSX
View extractDMG.sh
#!/bin/sh
usage() {
echo "$0 /path/to/image.dmg [/output/path]"
exit 0
}
DMG=$1
OUTPUT=$2
@glejeune
glejeune / id3editor.rb
Created Dec 16, 2011
My simple ID3v2 tag editor
View id3editor.rb
#!/usr/bin/ruby
require 'rubygems'
require 'mp3info'
require 'readline'
TAGS = {
"AENC" => "Audio encryption",
"APIC" => "Attached picture",
"COMM" => "Comments",
@glejeune
glejeune / markdown_viewer.rb
Created Dec 9, 2011
A tiny Markdown Viewer with Ruby/Gtk
View markdown_viewer.rb
#!/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 Nov 25, 2011
Yet another FooBarQix solution
View foobarqix.sh
#!/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
}
You can’t perform that action at this time.