Please explain in detail what will happen if the following program is executed:
#include <iostream>
int main() {
std::cout << "Hello, world!" << std::endl;
}
fallocate -l 256M /image.img # create file to store a filesystem | |
losetup /dev/loop0 # check if loop0 is free to use, if not continue with loop1, ... | |
losetup /dev/loop0 /image.img # create device using file | |
pvcreate /dev/loop0 # create lvm physical volume | |
vgcreate lvmstorage /dev/loop0 # create volume group "lvmstorage" using device | |
lvcreate -L 128M -n lv1 lvmstorage # create logical volume "lv1" with size 128M | |
mkfs.ext4 /dev/lvmstorage/lv1 # create file system | |
e2label /dev/lvmstorage/lv1 LV1 # set label "LV1" for device | |
mkdir /mnt/stuff | |
mount /dev/lvmstorage/lv1 /mnt/stuff # mount device |
<hash>
with your gist's hash):
# with ssh
git clone [email protected]:<hash>.git mygist
# with https
git clone https://gist.github.com/.git mygist
#!/bin/bash | |
# Sign a file with a private key using OpenSSL | |
# Encode the signature in Base64 format | |
# | |
# Usage: sign <file> <private_key> | |
# | |
# NOTE: to generate a public/private key use the following commands: | |
# | |
# openssl genrsa -aes128 -passout pass:<passphrase> -out private.pem 2048 | |
# openssl rsa -in private.pem -passin pass:<passphrase> -pubout -out public.pem |
type zero = unit | |
type 'a succ = unit -> 'a | |
type 'a nat = | |
| Zero : zero nat | |
| Succ : 'a nat -> 'a succ nat | |
module type T = sig | |
type t | |
val v : t nat |
# generate rootfs | |
sudo debootstrap --arch=amd64 trusty rootfs | |
# container.json (from README.md) | |
cat <<__EOF__>container.json | |
{ | |
"version": "0.1", | |
"os": "linux", | |
"arch": "amd64", | |
"processes": [ |
volatile int a, b, out; | |
__attribute__((noclone,noinline)) | |
void g(void) | |
{ | |
a = -1; | |
b = 0; | |
out = a/b; | |
} |
#!/usr/bin/expect -- | |
# for cygwin64 Windows | |
# | |
# timeout sec | |
#set timeout 10 | |
set timeout -1 | |
# HOST & ID | |
set HOST "[email protected]" |
import json, datetime | |
class RoundTripEncoder(json.JSONEncoder): | |
DATE_FORMAT = "%Y-%m-%d" | |
TIME_FORMAT = "%H:%M:%S" | |
def default(self, obj): | |
if isinstance(obj, datetime.datetime): | |
return { | |
"_type": "datetime", | |
"value": obj.strftime("%s %s" % ( |
// Just before switching jobs: | |
// Add one of these. | |
// Preferably into the same commit where you do a large merge. | |
// | |
// This started as a tweet with a joke of "C++ pro-tip: #define private public", | |
// and then it quickly escalated into more and more evil suggestions. | |
// I've tried to capture interesting suggestions here. | |
// | |
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_, | |
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant, |