Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
set -euo pipefail
MATTERMOST_URL="http://mattermost.qwant.loc"
MATTERMOST_API_URL="$MATTERMOST_URL/api/v4"
header_file=/tmp/header
body_file=/tmp/body
function request # ENDPOINT CURL_ARGUMENTS...
@Jules-Baratoux
Jules-Baratoux / docker-service-run
Created May 24, 2019 19:14
docker run based on docker service commands
#!/bin/bash
set -euo pipefail
# Usage:
# docker-service-run --tty alpine ls
#
function docker-service-wait # SERVICE
{
local interval=0.5s
import pkg
assert pkg.foo == 1
@Jules-Baratoux
Jules-Baratoux / graph.c
Last active August 29, 2015 14:22
Homework #8
/*
* graph.c
*/
#include <stdlib.h>
#include <string.h>
#include "graph.h"
#include "list.h"
#include "set.h"
@Jules-Baratoux
Jules-Baratoux / dlist.h
Last active August 29, 2015 14:22
Project #2 – dlist
#pragma once
#include <cassert>
#include <iterator>
#include <algorithm>
using std::equal;
using std::distance;
using std::copy;
namespace Project2
{
@Jules-Baratoux
Jules-Baratoux / one.cpp
Created May 29, 2015 08:48
Homework #8 – Object construction & const-correctness
struct Foo { int i; };
int main()
{
Foo t();
t.i = 7;
}
@Jules-Baratoux
Jules-Baratoux / IntegerRange.hh
Last active August 29, 2015 14:22
Homework #7 – IntegerRange::iterator
#pragma once
#include <iterator>
// Represents all integer values in the range [low, high).
// low must be <= high.
template <typename Int>
struct IntegerRange
{
struct iterator : public std::iterator<std::input_iterator_tag, Int>
{
@Jules-Baratoux
Jules-Baratoux / compress.hh
Last active August 29, 2015 14:21
Homework #6 – palindrome & compress
#pragma once
#include <cassert>
// compress accepts a forward iterator range [first, last) and an output iterator.
// compress copies the elements from the iterator range to the output iterator
// eliminating all consecutive duplicates.
template <typename ForwardIterator, typename OutputIterator>
void compress(ForwardIterator first, const ForwardIterator last, OutputIterator result)
{
if (first != last)
@Jules-Baratoux
Jules-Baratoux / hw7.c
Last active May 16, 2022 20:54
Homework #7 – outputSorted
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <alloca.h>
#include <assert.h>
#include "heap.h"
typedef struct Person_
{
@Jules-Baratoux
Jules-Baratoux / main.cpp
Created May 22, 2015 03:04
Project #1 – BigInt
/*===========================================================================
* Project #1 - CSE40478
*===========================================================================*/
#include <sstream>
#include <stdexcept>
#include <string>
using namespace std;
#include "UnitTest++.h"