- Qualsiasi cella viva con meno di due celle vive adiacenti muore, come per effetto d'isolamento;
- Qualsiasi cella viva con due o tre celle vive adiacenti sopravvive alla generazione successiva;
- Qualsiasi cella viva con più di tre celle vive adiacenti muore, come per effetto di sovrappopolazione;
- Qualsiasi cella morta con esattamente tre celle vive adiacenti diventa una cella viva, come per effetto di riproduzione.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
output="" | |
xrandr | while read line; do | |
if echo "${line}" | grep 'connected' > /dev/null; then | |
if echo "${line}" | grep ' connected' > /dev/null; then | |
output="$( echo "${line}" | sed 's/\(.*\) connected.*/\1/' )" | |
fi | |
elif ! echo "${line}" | grep '^Screen' > /dev/null; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <sys/resource.h> | |
int main() { | |
rlimit core_limits; | |
core_limits.rlim_cur = core_limits.rlim_max = RLIM_INFINITY; | |
setrlimit(RLIMIT_CORE, &core_limits); | |
std::cout << "begin\n"; | |
int* x = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <typename T> | |
T fix_modular_sequence(T&& seq, const typename T::value_type modulus) { | |
const auto threshold = modulus / 2.0; | |
auto it = seq.begin(); | |
auto prev = *it; | |
while (it != seq.end()) { | |
++it; | |
auto& curr = *it; | |
auto diff = curr - prev; | |
if (std::abs(diff) > threshold) curr -= (diff < 0 ? -1 : 1) * modulus; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_custom_target(demos) | |
find_package(Qt5Core REQUIRED) | |
find_package(Qt5Gui REQUIRED) | |
find_package(Qt5OpenGL REQUIRED) | |
find_package(OpenGL) | |
find_package(Eigen3) | |
set(CMAKE_AUTOMOC ON) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cassert> | |
#include <iostream> | |
#include <memory> | |
#include <mutex> | |
#include <string> | |
#include <unordered_map> | |
template <typename T> | |
std::shared_ptr<T> get_global(int id) { | |
using Map = std::unordered_map<int, std::weak_ptr<T>>; |
Nell'host di destinazione, avvio un nuovo container GitLab:
docker run --detach --hostname git.decktutor.net --publish 443:443 --publish 80:80 --publish 22:22 --name gitlab --restart always --volume /srv/gitlab/config:/etc/gitlab --volume /srv/gitlab/logs:/var/log/gitlab --volume /srv/gitlab/data:/var/opt/gitlab gitlab/gitlab-ce:10.8.4-ce.0
Copio gitlab.rb dalla sorgente alla destinazione /srv/gitlab/config/gitlab.rb
Nell'host di destinazione, riconfiguro gitlab con il nuovo gitlab.rb:
docker exec -ti gitlab gitlab-ctl reconfigure
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <memory> | |
struct Foo { | |
Foo(std::function<void()>&& fun) : f{std::move(fun)} { } | |
~Foo() { f(); } | |
std::function<void()> f; | |
}; | |
int main() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// When you don't have permissions to export to csv | |
$('#report-summary-popup table tr').map((i, e) => [$(e).find('td').map((i, e) => $(e).text().trim()).get()]).get().map(x => x.slice(1, x.length).join(',')).join('\n') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#define for_x for (int x = 0; x < w; x++) | |
#define for_y for (int y = 0; y < h; y++) | |
#define for_xy for_x for_y | |
void show(void* u, int w, int h) { | |
int(*univ)[w] = u; |