Skip to content

Instantly share code, notes, and snippets.

View lilianmoraru's full-sized avatar

Lilian Anatolie Moraru lilianmoraru

View GitHub Profile
@lilianmoraru
lilianmoraru / github-release.sh
Created August 12, 2021 08:08 — forked from typebrook/github-release.sh
[Github-release] A script manages release note or its asset with GitHub API v3 #github #release #curl #asset
#!/usr/bin/env sh
#
# Author: Hsieh Chin Fan (typebrook) <typebrook@gmail.com>
# License: MIT
# https://gist.github.com/typebrook/4947769e266173303d8848f496e272c9
#
# Originally created by stefanbuck
# fork from: https://gist.github.com/stefanbuck/ce788fee19ab6eb0b4447a85fc99f447
#
# --
@lilianmoraru
lilianmoraru / dkms-module-signing.md
Created May 22, 2019 20:00 — forked from dojoe/dkms-module-signing.md
Make DKMS sign kernel modules on installation, with full script support and somewhat distro independent

On systems with UEFI Secure Boot enabled, recent Linux kernels will only load signed modules, so it's about time DKMS grew the capability to sign modules it's building.

These scripts are extended and scriptified variants of https://computerlinguist.org/make-dkms-sign-kernel-modules-for-secure-boot-on-ubuntu-1604.html and https://askubuntu.com/questions/760671/could-not-load-vboxdrv-after-upgrade-to-ubuntu-16-04-and-i-want-to-keep-secur/768310#768310 and add some error checking, a passphrase around your signing key, and support for compressed modules.

dkms-sign-module is a wrapper for the more generic sign-modules which can also be used outside of DKMS.

Installation

  1. Create a directory under /root, say /root/module-signing, put the three scripts below in there and make them executable: chmod u+x one-time-setup sign-modules dkms-sign-module
@lilianmoraru
lilianmoraru / update_linux.bash
Last active March 3, 2019 11:37
pop_os self-compiling the Linux Kernel and installing inside EFI(also installs as backup the distro-provided kernel)
#! /bin/bash
set -euo pipefail
IFS=$'\n\t'
sudo update-alternatives --auto gcc
mtune_patch_path="${mtune_patch_path:-${HOME:?}/HelperScripts/enable_additional_cpu_optimizations_for_gcc_v8.1+_kernel_v4.13+.patch}"
kernel_config_path="${kernel_config_path:-${HOME:?}/HelperScripts/MyKernelConfig}"
extract_location="${extract_location:-/dev/shm/linux-source}"
CFLAGS="-O3 -DNDEBUG -D_GNU_SOURCE -fomit-frame-pointer -fno-asynchronous-unwind-tables -ftree-vectorize -floop-strip-mine -floop-block -fgraphite-identity -m64 -mavx -march=native -mtune=native"
CXXFLAGS="-O3 -DNDEBUG -D_GNU_SOURCE -fomit-frame-pointer -fno-asynchronous-unwind-tables -ftree-vectorize -floop-strip-mine -floop-block -fgraphite-identity -m64 -mavx -march=native -mtune=native"
@lilianmoraru
lilianmoraru / UpdateLLVM.bash
Last active April 5, 2018 08:01
Build locally your own optimized version of LLVM/Clang
#! /bin/bash
source_dir="" # Define this, example(this usually should be the device with the fastest Read perf): ${HOME:?}/git/llvm
build_dir="" # Define this, example(preferably a different device which can be slower): /ssd/llvm-build
install_prefix="" # Define this, example: /usr/local/llvm
release_branch="release_60"
update_project() {
local -r dir="${1:?}"
local -r branch="${2:?}"

Looking into the Future

futures-rs is the library which will hopefully become a shared foundation for everything async in Rust. However it's already become renowned for having a steep learning curve, even for experienced Rustaceans.

I think one of the best ways to get comfortable with using a library is to look at how it works internally: often API design can seem bizarre or impenetrable and it's only when you put yourself in the shoes of the library author that you can really understand why it was designed that way.

In this post I'll try to put down on "paper" my understanding of how futures work and I'll aim to do it in a visual way. I'm going to assume you're already somewhat familiar with Rust and why futures are a useful tool to have at one's disposal.

For most of this post I'll be talking about how things work today (as of September 2017). At the end I'll touch on what's being proposed next and also make a case for some of the changes I'd like to see.

If you're interested in learning more ab

Prerequisites

You'll need to have a system running that is accessible through a DNS record. It should have access to the public Habitat depot, https://app.habitat.sh so it can download the required packages.

You'll need to register an OAuth application for GitHub. You need the client ID and client secret that are created for the application later in this guide. Your system needs to have access to https://github.com so that it can authenticate.

Your system also needs to have an FQDN that can be resolved, for example depot.example.com. This will be used in your OAuth application's "Authorization Callback URL." For this example, use http://depot.example.com/#/sign-in. The /#/sign-in is required.

Operating System

Dynamic section at offset 0x655d48 contains 38 entries:
Tag Type Name/Value
0x0000000000000001 (NEEDED) Shared library: [libreadline.so.6]
0x0000000000000001 (NEEDED) Shared library: [libz.so.1]
0x0000000000000001 (NEEDED) Shared library: [libdl.so.2]
0x0000000000000001 (NEEDED) Shared library: [libncursesw.so.6]
0x0000000000000001 (NEEDED) Shared library: [libm.so.6]
0x0000000000000001 (NEEDED) Shared library: [libguile-2.0.so.22]
0x0000000000000001 (NEEDED) Shared library: [libgc.so.1]
0x0000000000000001 (NEEDED) Shared library: [libpthread.so.0]
linux-vdso.so.1 => (0x00007ffcf2f6d000)
libreadline.so.6 => /hab/pkgs/core/readline/6.3.8/20160729192706/lib/libreadline.so.6 (0x00007fe3a4584000)
libz.so.1 => /hab/pkgs/core/zlib/1.2.8/20160612064520/lib/libz.so.1 (0x00007fe3a4369000)
libdl.so.2 => /hab/pkgs/core/glibc/2.22/20160612063629/lib/libdl.so.2 (0x00007fe3a4165000)
libncursesw.so.6 => /hab/pkgs/core/ncurses/6.0/20160612075116/lib/libncursesw.so.6 (0x00007fe3a3f27000)
libm.so.6 => /hab/pkgs/core/glibc/2.22/20160612063629/lib/libm.so.6 (0x00007fe3a3c29000)
libguile-2.0.so.22 => /hab/pkgs/core/guile/2.0.12/20160729224832/lib/libguile-2.0.so.22 (0x00007fe3a383b000)
libgc.so.1 => not found
libpthread.so.0 => /hab/pkgs/core/glibc/2.22/20160612063629/lib/libpthread.so.0 (0x00007fe3a3601000)
libutil.so.1 => /hab/pkgs/core/glibc/2.22/20160612063629/lib/libutil.so.1 (0x00007fe3a33fe000)
containers:
ubuntu:
setup:
- !Ubuntu trusty
- !UbuntuUniverse
- !Env
HOME: /root
- !Install [git, ca-certificates, curl, gcc, g++, cmake,
build-essential, autoconf2.13, libcap-dev,
#! /bin/sh
## Warning: Please don't source this script from within' another script(note the use of "exit")
red_color="\033[1;31m"
green_color="\033[1;32m"
no_color="\033[0m"
throw_error() {
if [ ! -z "$1" ]; then
printf "${red_color}$1${no_color}\n"