├── ch07 ├── ch08 ├── ch09 ├── ch02 ├── ch05 ├── ch10 ├── ch11 ├── ch12 ├── examples ├── app │ ├── .gitignore │ ├── query.txt │ ├── requirements.txt │ ├── chaos2.py │ ├── Makefile │ ├── chaos.py │ └── app.py ├── who-you-gonna-call │ ├── src │ │ ├── .gitignore │ │ ├── legacy │ │ │ ├── ai_0.h │ │ │ ├── ai_1.h │ │ │ ├── ai_2.h │ │ │ ├── agile_0.h │ │ │ ├── agile_1.h │ │ │ ├── agile_2.h │ │ │ ├── cloud_0.h │ │ │ ├── cloud_1.h │ │ │ ├── cloud_2.h │ │ │ ├── grpc_0.h │ │ │ ├── grpc_1.h │ │ │ ├── grpc_2.h │ │ │ ├── iaas_0.h │ │ │ ├── iaas_1.h │ │ │ ├── lean_0.h │ │ │ ├── lean_1.h │ │ │ ├── paas_0.h │ │ │ ├── paas_1.h │ │ │ ├── pivot_0.h │ │ │ ├── pivot_1.h │ │ │ ├── saas_0.h │ │ │ ├── saas_1.h │ │ │ ├── crypto_0.h │ │ │ ├── crypto_1.h │ │ │ ├── crypto_2.h │ │ │ ├── disrupt_0.h │ │ │ ├── disrupt_1.h │ │ │ ├── disrupt_2.h │ │ │ ├── fission_0.h │ │ │ ├── fission_1.h │ │ │ ├── fission_2.h │ │ │ ├── new_4g_0.h │ │ │ ├── new_4g_1.h │ │ │ ├── organic_0.h │ │ │ ├── organic_1.h │ │ │ ├── unicorn_0.h │ │ │ ├── unicorn_1.h │ │ │ ├── big_data_0.h │ │ │ ├── big_data_1.h │ │ │ ├── big_data_2.h │ │ │ ├── blockchain_0.h │ │ │ ├── blockchain_1.h │ │ │ ├── blockchain_2.h │ │ │ ├── container_0.h │ │ │ ├── container_1.h │ │ │ ├── container_2.h │ │ │ ├── deep_dive_0.h │ │ │ ├── deep_dive_1.h │ │ │ ├── deep_dive_2.h │ │ │ ├── emulator_0.h │ │ │ ├── emulator_1.h │ │ │ ├── emulator_2.h │ │ │ ├── free_range_0.h │ │ │ ├── free_range_1.h │ │ │ ├── free_range_2.h │ │ │ ├── map_reduce_0.h │ │ │ ├── map_reduce_1.h │ │ │ ├── monolith_0.h │ │ │ ├── monolith_1.h │ │ │ ├── networking_0.h │ │ │ ├── networking_1.h │ │ │ ├── next_gen_0.h │ │ │ ├── next_gen_1.h │ │ │ ├── simulation_0.h │ │ │ ├── simulation_1.h │ │ │ ├── web_scale_0.h │ │ │ ├── web_scale_1.h │ │ │ ├── abandonware_0.h │ │ │ ├── abandonware_1.h │ │ │ ├── abandonware_2.h │ │ │ ├── accelerator_1.h │ │ │ ├── accelerator_2.h │ │ │ ├── data_mining_0.h │ │ │ ├── data_mining_1.h │ │ │ ├── data_mining_2.h │ │ │ ├── scalability_0.h │ │ │ ├── scalability_1.h │ │ │ ├── bleeding_edge_0.h │ │ │ ├── bleeding_edge_1.h │ │ │ ├── bleeding_edge_2.h │ │ │ ├── microservices_0.h │ │ │ ├── microservices_1.h │ │ │ ├── preprocessing_0.h │ │ │ ├── preprocessing_1.h │ │ │ ├── previous_legacy_0.h │ │ │ ├── previous_legacy_1.h │ │ │ ├── private_cloud_0.h │ │ │ ├── private_cloud_1.h │ │ │ ├── virtualization_0.h │ │ │ ├── virtualization_1.h │ │ │ ├── enterprise_ready_0.h │ │ │ ├── enterprise_ready_1.h │ │ │ ├── enterprise_ready_2.h │ │ │ ├── machine_learning_0.h │ │ │ ├── machine_learning_1.h │ │ │ ├── internet_of_things_0.h │ │ │ ├── internet_of_things_1.h │ │ │ ├── writer.h │ │ │ ├── writer.c │ │ │ ├── grpc_2.c │ │ │ ├── ai_0.c │ │ │ ├── ai_1.c │ │ │ ├── ai_2.c │ │ │ ├── grpc_0.c │ │ │ ├── grpc_1.c │ │ │ ├── paas_0.c │ │ │ ├── paas_1.c │ │ │ ├── agile_0.c │ │ │ ├── agile_1.c │ │ │ ├── agile_2.c │ │ │ ├── saas_0.c │ │ │ ├── saas_1.c │ │ │ ├── cloud_0.c │ │ │ ├── cloud_1.c │ │ │ ├── cloud_2.c │ │ │ ├── lean_0.c │ │ │ ├── lean_1.c │ │ │ ├── iaas_0.c │ │ │ ├── iaas_1.c │ │ │ ├── new_4g_0.c │ │ │ ├── pivot_0.c │ │ │ ├── pivot_1.c │ │ │ ├── crypto_0.c │ │ │ ├── crypto_1.c │ │ │ ├── crypto_2.c │ │ │ ├── new_4g_1.c │ │ │ ├── organic_0.c │ │ │ ├── organic_1.c │ │ │ ├── disrupt_0.c │ │ │ ├── disrupt_1.c │ │ │ ├── disrupt_2.c │ │ │ ├── fission_0.c │ │ │ ├── fission_1.c │ │ │ ├── fission_2.c │ │ │ ├── next_gen_0.c │ │ │ ├── next_gen_1.c │ │ │ ├── unicorn_0.c │ │ │ ├── unicorn_1.c │ │ │ ├── monolith_0.c │ │ │ ├── monolith_1.c │ │ │ ├── big_data_0.c │ │ │ ├── big_data_1.c │ │ │ ├── big_data_2.c │ │ │ ├── container_0.c │ │ │ ├── container_1.c │ │ │ ├── container_2.c │ │ │ ├── deep_dive_0.c │ │ │ ├── deep_dive_1.c │ │ │ ├── deep_dive_2.c │ │ │ ├── emulator_0.c │ │ │ ├── emulator_1.c │ │ │ ├── emulator_2.c │ │ │ ├── blockchain_0.c │ │ │ ├── blockchain_1.c │ │ │ ├── blockchain_2.c │ │ │ ├── free_range_0.c │ │ │ ├── free_range_1.c │ │ │ ├── free_range_2.c │ │ │ ├── web_scale_0.c │ │ │ ├── web_scale_1.c │ │ │ ├── networking_0.c │ │ │ ├── networking_1.c │ │ │ ├── simulation_0.c │ │ │ ├── simulation_1.c │ │ │ ├── abandonware_0.c │ │ │ ├── accelerator_1.c │ │ │ ├── accelerator_2.c │ │ │ ├── map_reduce_0.c │ │ │ ├── map_reduce_1.c │ │ │ ├── data_mining_0.c │ │ │ ├── data_mining_1.c │ │ │ ├── data_mining_2.c │ │ │ ├── scalability_0.c │ │ │ ├── scalability_1.c │ │ │ ├── abandonware_1.c │ │ │ ├── abandonware_2.c │ │ │ ├── private_cloud_0.c │ │ │ ├── private_cloud_1.c │ │ │ ├── microservices_0.c │ │ │ ├── microservices_1.c │ │ │ ├── bleeding_edge_0.c │ │ │ ├── bleeding_edge_1.c │ │ │ ├── bleeding_edge_2.c │ │ │ ├── preprocessing_0.c │ │ │ ├── preprocessing_1.c │ │ │ ├── virtualization_0.c │ │ │ ├── virtualization_1.c │ │ │ ├── previous_legacy_0.c │ │ │ ├── previous_legacy_1.c │ │ │ ├── enterprise_ready_0.c │ │ │ ├── enterprise_ready_1.c │ │ │ ├── enterprise_ready_2.c │ │ │ ├── machine_learning_0.c │ │ │ ├── machine_learning_1.c │ │ │ ├── internet_of_things_0.c │ │ │ └── internet_of_things_1.c │ │ ├── respond.h │ │ ├── Dockerfile │ │ ├── respond.c │ │ ├── Makefile │ │ ├── main.c │ │ └── generate_legacy.py │ ├── README.md │ ├── Makefile │ ├── hello-syscall.c │ └── seccomp.c ├── killer-whiles │ ├── mystery000.c │ ├── static │ │ └── api │ │ │ └── v1 │ │ │ └── index.html │ ├── run_ab.sh │ ├── faas001_a.service │ ├── faas001_b.service │ ├── nginx.loadbalancer.conf │ ├── Makefile │ ├── cereal_killer.sh │ ├── killer_while.sh │ └── mystery001.c ├── jvm │ ├── org │ │ ├── agent │ │ │ ├── manifest.mf │ │ │ ├── Agent.java │ │ │ └── ClassPrinter.java │ │ ├── agent2 │ │ │ ├── manifest.mf │ │ │ ├── Agent.java │ │ │ └── ClassInjector.java │ │ └── my │ │ │ ├── Example1.java │ │ │ └── Example2.java │ ├── throw.btm │ └── Makefile ├── poking-docker │ ├── experiment3 │ │ ├── Dockerfile │ │ └── Makefile │ ├── experiment1 │ │ ├── control │ │ │ ├── Dockerfile │ │ │ ├── Makefile │ │ │ └── run.sh │ │ └── failure │ │ │ ├── Dockerfile │ │ │ ├── Makefile │ │ │ └── consume.sh │ ├── experiment2 │ │ ├── pid-printer.sh │ │ └── attach-pid-namespace.sh │ ├── experiment5.sh │ ├── container-ish.sh │ ├── meower-stack.yml │ ├── container-ish-2.sh │ └── new-filesystem.sh ├── js │ ├── fetch.js │ ├── XMLHttpRequest-1.js │ ├── XMLHttpRequest-3.js │ ├── XMLHttpRequest-4.js │ └── XMLHttpRequest-2.js ├── kubernetes │ ├── install-powerfulseal.sh │ ├── powerfulseal-policy-minimal.yml │ ├── kube-thanos.sh │ ├── experiment4b.yml │ ├── experiment1b.yml │ ├── experiment4a.yml │ ├── Makefile │ ├── experiment2b.yml │ ├── goldpinger-rbac.yml │ ├── goldpinger-chaos.yml │ ├── goldpinger.yml │ └── experiment3.yml └── busy-neighbours │ ├── benign.sh │ ├── mystery002 │ └── mystery002-cgroups.sh ├── ch03 ├── ch06 ├── vm ├── .gitignore ├── ansible.cfg ├── ansible │ ├── site.yml │ └── prerequisites │ │ ├── templates │ │ ├── config-localhost.php │ │ └── wordpress-site │ │ ├── defaults │ │ └── main.yml │ │ └── tasks │ │ └── main.yml ├── install-virtualbox-guest-additions.sh ├── Makefile ├── README.md └── packer.json ├── media └── DOTD_NewMEAP_Pawlikowski.png ├── .gitignore ├── parts.sha256 ├── Makefile ├── README.md └── getting-started.md /ch07: -------------------------------------------------------------------------------- 1 | examples/jvm/ -------------------------------------------------------------------------------- /ch08: -------------------------------------------------------------------------------- 1 | examples/app/ -------------------------------------------------------------------------------- /ch09: -------------------------------------------------------------------------------- 1 | examples/js/ -------------------------------------------------------------------------------- /ch02: -------------------------------------------------------------------------------- 1 | examples/killer-whiles/ -------------------------------------------------------------------------------- /ch05: -------------------------------------------------------------------------------- 1 | ./examples/poking-docker -------------------------------------------------------------------------------- /ch10: -------------------------------------------------------------------------------- 1 | examples/kubernetes/ -------------------------------------------------------------------------------- /ch11: -------------------------------------------------------------------------------- 1 | examples/kubernetes/ -------------------------------------------------------------------------------- /ch12: -------------------------------------------------------------------------------- 1 | examples/kubernetes/ -------------------------------------------------------------------------------- /examples/app/.gitignore: -------------------------------------------------------------------------------- 1 | env -------------------------------------------------------------------------------- /ch03: -------------------------------------------------------------------------------- 1 | examples/busy-neighbours/ -------------------------------------------------------------------------------- /ch06: -------------------------------------------------------------------------------- 1 | examples/who-you-gonna-call/ -------------------------------------------------------------------------------- /examples/app/query.txt: -------------------------------------------------------------------------------- 1 | query=Apples -------------------------------------------------------------------------------- /vm/.gitignore: -------------------------------------------------------------------------------- 1 | packer_cache 2 | env 3 | -------------------------------------------------------------------------------- /examples/app/requirements.txt: -------------------------------------------------------------------------------- 1 | flask 2 | redis -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/.gitignore: -------------------------------------------------------------------------------- 1 | main 2 | *.o -------------------------------------------------------------------------------- /vm/ansible.cfg: -------------------------------------------------------------------------------- 1 | [defaults] 2 | callback_whitelist = profile_tasks 3 | -------------------------------------------------------------------------------- /examples/killer-whiles/mystery000.c: -------------------------------------------------------------------------------- 1 | int main() 2 | { 3 | return 1/0; 4 | } 5 | -------------------------------------------------------------------------------- /examples/killer-whiles/static/api/v1/index.html: -------------------------------------------------------------------------------- 1 | { 2 | "FizzBuzz": true 3 | } -------------------------------------------------------------------------------- /examples/who-you-gonna-call/README.md: -------------------------------------------------------------------------------- 1 | # A legacy program (written in C) 2 | 3 | 4 | -------------------------------------------------------------------------------- /examples/jvm/org/agent/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Premain-Class: org.agent.Agent 3 | -------------------------------------------------------------------------------- /examples/jvm/org/agent2/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Premain-Class: org.agent2.Agent 3 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/ai_0.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t ai_0(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/ai_1.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t ai_1(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/ai_2.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t ai_2(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/Makefile: -------------------------------------------------------------------------------- 1 | seccomp-example: 2 | cc seccomp.c -lseccomp -o seccomp-example 3 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/agile_0.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t agile_0(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/agile_1.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t agile_1(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/agile_2.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t agile_2(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/cloud_0.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t cloud_0(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/cloud_1.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t cloud_1(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/cloud_2.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t cloud_2(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/grpc_0.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t grpc_0(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/grpc_1.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t grpc_1(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/grpc_2.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t grpc_2(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/iaas_0.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t iaas_0(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/iaas_1.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t iaas_1(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/lean_0.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t lean_0(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/lean_1.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t lean_1(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/paas_0.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t paas_0(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/paas_1.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t paas_1(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/pivot_0.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t pivot_0(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/pivot_1.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t pivot_1(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/saas_0.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t saas_0(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/saas_1.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t saas_1(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/crypto_0.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t crypto_0(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/crypto_1.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t crypto_1(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/crypto_2.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t crypto_2(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/disrupt_0.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t disrupt_0(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/disrupt_1.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t disrupt_1(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/disrupt_2.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t disrupt_2(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/fission_0.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t fission_0(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/fission_1.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t fission_1(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/fission_2.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t fission_2(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/new_4g_0.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t new_4g_0(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/new_4g_1.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t new_4g_1(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/organic_0.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t organic_0(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/organic_1.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t organic_1(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/unicorn_0.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t unicorn_0(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/unicorn_1.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t unicorn_1(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/big_data_0.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t big_data_0(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/big_data_1.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t big_data_1(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/big_data_2.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t big_data_2(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/blockchain_0.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t blockchain_0(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/blockchain_1.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t blockchain_1(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/blockchain_2.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t blockchain_2(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/container_0.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t container_0(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/container_1.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t container_1(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/container_2.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t container_2(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/deep_dive_0.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t deep_dive_0(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/deep_dive_1.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t deep_dive_1(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/deep_dive_2.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t deep_dive_2(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/emulator_0.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t emulator_0(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/emulator_1.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t emulator_1(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/emulator_2.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t emulator_2(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/free_range_0.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t free_range_0(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/free_range_1.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t free_range_1(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/free_range_2.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t free_range_2(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/map_reduce_0.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t map_reduce_0(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/map_reduce_1.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t map_reduce_1(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/monolith_0.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t monolith_0(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/monolith_1.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t monolith_1(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/networking_0.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t networking_0(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/networking_1.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t networking_1(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/next_gen_0.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t next_gen_0(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/next_gen_1.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t next_gen_1(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/simulation_0.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t simulation_0(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/simulation_1.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t simulation_1(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/web_scale_0.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t web_scale_0(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/web_scale_1.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t web_scale_1(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/abandonware_0.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t abandonware_0(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/abandonware_1.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t abandonware_1(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/abandonware_2.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t abandonware_2(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/accelerator_1.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t accelerator_1(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/accelerator_2.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t accelerator_2(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/data_mining_0.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t data_mining_0(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/data_mining_1.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t data_mining_1(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/data_mining_2.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t data_mining_2(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/scalability_0.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t scalability_0(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/scalability_1.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t scalability_1(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/bleeding_edge_0.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t bleeding_edge_0(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/bleeding_edge_1.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t bleeding_edge_1(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/bleeding_edge_2.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t bleeding_edge_2(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/microservices_0.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t microservices_0(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/microservices_1.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t microservices_1(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/preprocessing_0.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t preprocessing_0(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/preprocessing_1.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t preprocessing_1(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/previous_legacy_0.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t previous_legacy_0(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/previous_legacy_1.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t previous_legacy_1(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/private_cloud_0.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t private_cloud_0(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/private_cloud_1.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t private_cloud_1(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/virtualization_0.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t virtualization_0(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/virtualization_1.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t virtualization_1(int); 5 | -------------------------------------------------------------------------------- /examples/poking-docker/experiment3/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:focal-20200423 2 | 3 | RUN apt-get update && apt-get install -y stress 4 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/enterprise_ready_0.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t enterprise_ready_0(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/enterprise_ready_1.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t enterprise_ready_1(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/enterprise_ready_2.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t enterprise_ready_2(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/machine_learning_0.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t machine_learning_0(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/machine_learning_1.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t machine_learning_1(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/internet_of_things_0.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t internet_of_things_0(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/internet_of_things_1.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | ssize_t internet_of_things_1(int); 5 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/respond.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | ssize_t respond(int fildes, const void *buf, size_t nbyte); 4 | -------------------------------------------------------------------------------- /media/DOTD_NewMEAP_Pawlikowski.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seeker89/chaos-engineering-book/HEAD/media/DOTD_NewMEAP_Pawlikowski.png -------------------------------------------------------------------------------- /examples/who-you-gonna-call/hello-syscall.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | return printf("Hello, syscall!\n"); 6 | } 7 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/writer.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #define CTN_LENGTH "291" 4 | 5 | ssize_t write_content(int); 6 | -------------------------------------------------------------------------------- /examples/poking-docker/experiment1/control/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:focal-20200423 2 | 3 | COPY run.sh /run.sh 4 | 5 | ENTRYPOINT ["/run.sh"] 6 | -------------------------------------------------------------------------------- /vm/ansible/site.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: workers 3 | gather_facts: true 4 | roles: 5 | - {role: prerequisites, tags: ['prerequisites','base']} 6 | -------------------------------------------------------------------------------- /examples/poking-docker/experiment1/failure/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:focal-20200423 2 | 3 | COPY consume.sh /consume.sh 4 | 5 | ENTRYPOINT ["/consume.sh"] 6 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:focal-20200423 2 | 3 | COPY ./legacy_server /legacy_server 4 | 5 | ENTRYPOINT [ "/legacy_server" ] 6 | -------------------------------------------------------------------------------- /examples/js/fetch.js: -------------------------------------------------------------------------------- 1 | const original = window.fetch; 2 | window.fetch = function(){ 3 | console.log("Hello chaos"); 4 | return original.apply(this, [...arguments]); 5 | } -------------------------------------------------------------------------------- /examples/killer-whiles/run_ab.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # print the command 4 | set -o xtrace 5 | 6 | # run the benchmark 7 | ab -t 30 -c 10 -l http://127.0.0.1:8003/api/v1/ 8 | -------------------------------------------------------------------------------- /examples/poking-docker/experiment2/pid-printer.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | echo "Press [CTRL+C] to stop.." 3 | while : 4 | do 5 | echo `date` "Hi, I'm PID $$ and I'm feeling sleeeeeepy..." && sleep 2 6 | done 7 | -------------------------------------------------------------------------------- /examples/poking-docker/experiment3/Makefile: -------------------------------------------------------------------------------- 1 | tag ?= stressful 2 | 3 | build: 4 | docker build -t ${tag} . 5 | 6 | run: 7 | docker run --rm --name stressful -ti ${tag} 8 | 9 | .PHONY: build run 10 | -------------------------------------------------------------------------------- /examples/jvm/org/my/Example1.java: -------------------------------------------------------------------------------- 1 | package org.my; 2 | 3 | class Example1 4 | { 5 | public static void main(String[] args) 6 | { 7 | System.out.println("Hello chaos!"); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /examples/poking-docker/experiment1/control/Makefile: -------------------------------------------------------------------------------- 1 | tag ?= experiment1-control 2 | 3 | build: 4 | docker build -t ${tag} . 5 | 6 | run: 7 | docker run --rm --name experiment1-control -ti ${tag} 8 | 9 | .PHONY: build run 10 | -------------------------------------------------------------------------------- /examples/kubernetes/install-powerfulseal.sh: -------------------------------------------------------------------------------- 1 | # check python version 2 | python3 --version 3 | 4 | # create a virtual env 5 | python3 -m virtualenv env 6 | source env/bin/activate 7 | 8 | # install PowerfulSeal 9 | pip install powerfulseal 10 | -------------------------------------------------------------------------------- /examples/js/XMLHttpRequest-1.js: -------------------------------------------------------------------------------- 1 | const realOpen = window.XMLHttpRequest.prototype.open; 2 | window.XMLHttpRequest.prototype.open = function() { 3 | let args = [...arguments]; 4 | console.log(...args); 5 | return realOpen.apply(this, args); 6 | }; 7 | -------------------------------------------------------------------------------- /examples/jvm/throw.btm: -------------------------------------------------------------------------------- 1 | RULE throw an exception at output 2 | CLASS SystemOutFizzBuzzOutputStrategy 3 | METHOD output 4 | AT ENTRY 5 | IF true 6 | DO 7 | # traceln("entering the method output"); 8 | throw new java.io.IOException("BOOM"); 9 | ENDRULE 10 | -------------------------------------------------------------------------------- /examples/killer-whiles/faas001_a.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=FizzBuzz as a Service API prototype - instance A 3 | 4 | [Service] 5 | ExecStart=/usr/local/bin/python3 -m http.server 8001 --directory /home/chaos/src/examples/killer-whiles/static 6 | Restart=always 7 | -------------------------------------------------------------------------------- /examples/killer-whiles/faas001_b.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=FizzBuzz as a Service API prototype - instance B 3 | 4 | [Service] 5 | ExecStart=/usr/local/bin/python3 -m http.server 8002 --directory /home/chaos/src/examples/killer-whiles/static 6 | Restart=always 7 | -------------------------------------------------------------------------------- /examples/poking-docker/experiment5.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | pumba netem \ 4 | --duration 60s \ 5 | --tc-image gaiadocker/iproute2 \ 6 | delay \ 7 | --time 100 \ 8 | --jitter 0 \ 9 | --correlation 0 \ 10 | "re2:meower_db" 11 | -------------------------------------------------------------------------------- /examples/kubernetes/powerfulseal-policy-minimal.yml: -------------------------------------------------------------------------------- 1 | scenarios: 2 | - name: Just check that my service responds 3 | steps: 4 | - probeHTTP: 5 | target: 6 | service: 7 | name: my-service 8 | namespace: myapp 9 | endpoint: /healthz 10 | -------------------------------------------------------------------------------- /examples/poking-docker/experiment1/failure/Makefile: -------------------------------------------------------------------------------- 1 | tag ?= experiment1-failure 2 | 3 | build: 4 | docker build -t ${tag} . 5 | 6 | run: 7 | docker run --rm -ti ${tag} 8 | 9 | run2: 10 | docker run --storage-opt size=1g --rm -ti ${tag} 11 | 12 | .PHONY: build run run2 13 | -------------------------------------------------------------------------------- /examples/kubernetes/kube-thanos.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # A comic-book-villain-style killing 4 | while : 5 | do 6 | date 7 | kubectl get pods -l app=goldpinger -o name \ 8 | | sort --random-sort \ 9 | | head -n 1 \ 10 | | xargs kubectl delete 11 | sleep 10 12 | done 13 | -------------------------------------------------------------------------------- /examples/poking-docker/experiment2/attach-pid-namespace.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | CONTAINER_PID=$(docker inspect -f '{{ .State.Pid }}' experiment2) 3 | sudo nsenter \ 4 | --pid \ 5 | --target $CONTAINER_PID \ 6 | /bin/bash /home/chaos/src/examples/poking-docker/experiment2/pid-printer.sh 7 | -------------------------------------------------------------------------------- /examples/busy-neighbours/benign.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # sleep a little, sneakily 4 | sleep 20 5 | 6 | # Just doing some lightweight background work 7 | # Nothing to see here ;) 8 | while : 9 | do 10 | stress --cpu 2 -m 1 -d 1 --timeout 30 2>&1 > /dev/null 11 | sleep 5 12 | done 13 | -------------------------------------------------------------------------------- /vm/install-virtualbox-guest-additions.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | mkdir /tmp/additions 4 | sudo mount -t iso9660 -o loop /home/chaos/VBoxGuestAdditions.iso /tmp/additions 5 | sudo /tmp/additions/VBoxLinuxAdditions.run 6 | sudo umount /tmp/additions 7 | rm -rf /tmp/additions /home/chaos/VBoxGuestAdditions.iso 8 | -------------------------------------------------------------------------------- /examples/kubernetes/experiment4b.yml: -------------------------------------------------------------------------------- 1 | scenarios: 2 | - name: Stop that host! 3 | steps: 4 | - podAction: 5 | matches: 6 | - namespace: mynamespace 7 | filters: 8 | - randomSample: 9 | size: 1 10 | actions: 11 | - stopHost: 12 | autoRestart: true 13 | -------------------------------------------------------------------------------- /examples/js/XMLHttpRequest-3.js: -------------------------------------------------------------------------------- 1 | const originalSend = window.XMLHttpRequest.prototype.send; 2 | window.XMLHttpRequest.prototype.send = function(){ 3 | console.log("Chaos calling", new Date()); 4 | let that = this; 5 | setTimeout(function() { 6 | return originalSend.apply(that, [...arguments]); 7 | }, 1000); 8 | } 9 | -------------------------------------------------------------------------------- /examples/jvm/org/agent/Agent.java: -------------------------------------------------------------------------------- 1 | package org.agent; 2 | 3 | import java.lang.instrument.Instrumentation; 4 | 5 | class Agent { 6 | public static void premain(String args, Instrumentation instrumentation){ 7 | ClassPrinter transformer = new ClassPrinter(); 8 | instrumentation.addTransformer(transformer); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /vm/ansible/prerequisites/templates/config-localhost.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/jvm/org/agent2/Agent.java: -------------------------------------------------------------------------------- 1 | package org.agent2; 2 | 3 | import java.lang.instrument.Instrumentation; 4 | 5 | class Agent { 6 | public static void premain(String args, Instrumentation instrumentation){ 7 | ClassInjector transformer = new ClassInjector(); 8 | instrumentation.addTransformer(transformer); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/writer.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include "abandonware_0.h" 4 | 5 | ssize_t write_content(int fd){ 6 | // Not sure what else should go here, but here's for nothing 7 | abandonware_0(fd); 8 | // TODO return something useful 9 | // TODO error handling 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Binaries for programs and plugins 2 | *.exe 3 | *.exe~ 4 | *.dll 5 | *.so 6 | *.dylib 7 | 8 | # Test binary, built with `go test -c` 9 | *.test 10 | 11 | # Output of the go coverage tool, specifically when used with LiteIDE 12 | *.out 13 | 14 | # Dependency directories (remove the comment below to include it) 15 | # vendor/ 16 | -------------------------------------------------------------------------------- /examples/poking-docker/experiment1/control/run.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | FILESIZE=$((50*1024*1024)) 3 | FILENAME=testfile 4 | echo "Press [CTRL+C] to stop.." 5 | while : 6 | do 7 | fallocate -l $FILESIZE $FILENAME && echo "OK wrote the file" `ls -alhi $FILENAME` || echo "Couldn't write the file" 8 | sleep 2 9 | rm $FILENAME || echo "Couldn't delete the file" 10 | done 11 | -------------------------------------------------------------------------------- /examples/jvm/org/my/Example2.java: -------------------------------------------------------------------------------- 1 | package org.my; 2 | import java.io.IOException; 3 | 4 | class Example2 5 | { 6 | public static void main(String[] args) throws IOException 7 | { 8 | Example2.throwIOException(); 9 | } 10 | 11 | public static void throwIOException() throws IOException 12 | { 13 | throw new IOException("Oops"); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /examples/js/XMLHttpRequest-4.js: -------------------------------------------------------------------------------- 1 | const originalSend = window.XMLHttpRequest.prototype.send; 2 | var counter = 0; 3 | window.XMLHttpRequest.prototype.send = function(){ 4 | counter++; 5 | if (counter % 2 == 1){ 6 | return originalSend.apply(this, [...arguments]); 7 | } 8 | console.log("Unlucky " + counter + "!", new Date()); 9 | this.dispatchEvent(new Event('error')); 10 | } 11 | -------------------------------------------------------------------------------- /parts.sha256: -------------------------------------------------------------------------------- 1 | e3342f49d2e3983dac5c0690f32e05c750262bcb5e6a958027c305d0dd11c88d ./chaos-engineering-VM-107cd1c250004e162e168607b71d09c41a66b0ec.zip 2 | faf3ade443b1b82a60af45848ad9fc91b6bfea30afcdeec881ea89bc7ab038fc ./chaos-engineering-VM-107cd1c250004e162e168607b71d09c41a66b0ec.z01 3 | 1c4ff86ea7171537bdd6ea8429a4192ec61251f2b4a612cf86e00d0583d48e5b ./chaos-engineering-VM-107cd1c250004e162e168607b71d09c41a66b0ec.z02 4 | -------------------------------------------------------------------------------- /examples/kubernetes/experiment1b.yml: -------------------------------------------------------------------------------- 1 | config: 2 | runStrategy: 3 | runs: 1 4 | scenarios: 5 | - name: Kill 50% of Goldpinger nodes 6 | steps: 7 | - podAction: 8 | matches: 9 | - labels: 10 | selector: app=goldpinger 11 | namespace: default 12 | filters: 13 | - randomSample: 14 | ratio: 0.5 15 | actions: 16 | - kill: 17 | force: true 18 | -------------------------------------------------------------------------------- /vm/ansible/prerequisites/templates/wordpress-site: -------------------------------------------------------------------------------- 1 | Alias /blog /usr/share/wordpress 2 | 3 | Options FollowSymLinks 4 | AllowOverride Limit Options FileInfo 5 | DirectoryIndex index.php 6 | Order allow,deny 7 | Allow from all 8 | 9 | 10 | Options FollowSymLinks 11 | Order allow,deny 12 | Allow from all 13 | -------------------------------------------------------------------------------- /examples/poking-docker/experiment1/failure/consume.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | FILESIZE=$((50*1024*1024)) 3 | FILENAME=testfile 4 | echo "Press [CTRL+C] to stop.." 5 | count=0 6 | while : 7 | do 8 | new_name=$FILENAME.$count 9 | fallocate -l $FILESIZE $new_name \ 10 | && echo "OK wrote the file" `ls -alhi $new_name` \ 11 | || (echo "Couldn't write the file" $new_name "Sleeping a bit"; sleep 5) 12 | (( count++ )) 13 | done 14 | -------------------------------------------------------------------------------- /examples/js/XMLHttpRequest-2.js: -------------------------------------------------------------------------------- 1 | function applyChaos(obj, methodName, delay){ 2 | const originalMethod = obj.prototype[methodName]; 3 | obj.prototype[methodName] = function(){ 4 | let that = this; 5 | let args = [...arguments]; 6 | let cb = function() { 7 | return originalMethod.apply(that, args); 8 | } 9 | setTimeout(cb, delay); 10 | } 11 | } 12 | 13 | applyChaos(window.XMLHttpRequest, "send", 1000); -------------------------------------------------------------------------------- /examples/busy-neighbours/mystery002: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "Press [CTRL+C] to stop.." 3 | 4 | # start some completely benign background daemon to do some __lightweight__work 5 | # ^ this simulates Alice's server's environment 6 | export dir=$(dirname "$(readlink -f "$0")") 7 | (bash $dir/benign.sh)& 8 | 9 | # do the actual work 10 | while : 11 | do 12 | echo "Calculating pi's 3000 digits..." 13 | time echo "scale=3000; 4*a(1)" | bc -l | head -n1 14 | done 15 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | all: killer-whiles who-you-gonna-call jvm app 2 | 3 | killer-whiles: 4 | (cd examples/killer-whiles && make) 5 | 6 | who-you-gonna-call: 7 | (cd examples/who-you-gonna-call && make) 8 | (cd examples/who-you-gonna-call/src && make gen && make) 9 | 10 | jvm: 11 | (cd examples/jvm && make) 12 | 13 | clean: 14 | rm -rf vm/vm.zip vm/parts.sha256 vm/chaos-engineering-VM* 15 | 16 | app: 17 | (cd examples/app && make install) 18 | 19 | .PHONY: killer-whiles who-you-gonna-call clean 20 | -------------------------------------------------------------------------------- /examples/killer-whiles/nginx.loadbalancer.conf: -------------------------------------------------------------------------------- 1 | # http { 2 | # http block already in /etc/nginx/nginx.conf 3 | upstream backend { 4 | server 127.0.0.1:8001 max_fails=1 fail_timeout=1s; 5 | server 127.0.0.1:8002 max_fails=1 fail_timeout=1s; 6 | } 7 | server { 8 | listen 8003; 9 | 10 | location / { 11 | proxy_pass http://backend; 12 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 13 | } 14 | } 15 | # } 16 | -------------------------------------------------------------------------------- /examples/kubernetes/experiment4a.yml: -------------------------------------------------------------------------------- 1 | config: 2 | runStrategy: 3 | runs: 1 4 | scenarios: 5 | - name: Test load-balancing on master nodes 6 | steps: 7 | - nodeAction: 8 | matches: 9 | - property: 10 | name: "az" 11 | value: "WEST.*" 12 | filters: 13 | - randomSample: 14 | size: 1 15 | actions: 16 | - stop: 17 | autoRestart: true 18 | - probeHTTP: 19 | target: 20 | url: "http://load-balancer.example.com" 21 | -------------------------------------------------------------------------------- /examples/kubernetes/Makefile: -------------------------------------------------------------------------------- 1 | populate: 2 | toxiproxy-cli \ 3 | -h $(shell minikube service --url goldpinger-chaos) \ 4 | create chaos \ 5 | -l 0.0.0.0:8080 \ 6 | -u localhost:9090 7 | toxiproxy-cli \ 8 | -h $(shell minikube service --url goldpinger-chaos) \ 9 | toxic add \ 10 | --type latency \ 11 | --a latency=250 \ 12 | --upstream \ 13 | chaos 14 | 15 | delete: 16 | toxiproxy-cli \ 17 | -h $(shell minikube service --url goldpinger-chaos) \ 18 | delete chaos 19 | 20 | .PHONY: populate delete 21 | -------------------------------------------------------------------------------- /examples/poking-docker/container-ish.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | CURRENT_DIRECTORY="$(dirname "${0}")" 3 | FILESYSTEM_NAME=${1:-container-attempt-2} 4 | 5 | # Step 1: execute our familiar new-filesystem script 6 | bash $CURRENT_DIRECTORY/new-filesystem.sh $FILESYSTEM_NAME 7 | cd $FILESYSTEM_NAME 8 | 9 | # Step 2: create a new pid namespace, and start a chrooted bash session 10 | sudo unshare \ 11 | --fork \ 12 | --pid \ 13 | chroot . \ 14 | /bin/bash -c "mkdir -p /proc && /bin/mount -t proc proc /proc && exec /bin/bash" 15 | -------------------------------------------------------------------------------- /examples/app/chaos2.py: -------------------------------------------------------------------------------- 1 | import os 2 | import redis 3 | 4 | 5 | def raise_rediserror_every_other_time_if_enabled(func): 6 | """ Decorator, raises an exception every other call to the wrapped function """ 7 | if not os.environ.get("CHAOS"): 8 | return func 9 | counter = 0 10 | def wrapped(*args, **kwargs): 11 | nonlocal counter 12 | counter += 1 13 | if counter % 2 == 0: 14 | raise redis.exceptions.RedisError("CHAOS") 15 | return func(*args, **kwargs) 16 | return wrapped 17 | -------------------------------------------------------------------------------- /examples/app/Makefile: -------------------------------------------------------------------------------- 1 | run: install 2 | FLASK_ENV=development FLASK_APP=app.py python3 -m flask run 3 | 4 | run_chaos: install 5 | CHAOS=true CHAOS_DELAY_SECONDS=0.1 \ 6 | FLASK_ENV=development FLASK_APP=app.py python3 -m flask run 7 | 8 | install: 9 | pip3 install --user -r requirements.txt 10 | 11 | bench: 12 | echo "query=Apples" > query.txt && \ 13 | ab -c 1 -t 10 \ 14 | -H "Cookie: sessionID=something" \ 15 | -H "Content-type: application/x-www-form-urlencoded" \ 16 | -p query.txt \ 17 | http://127.0.0.1:5000/search 18 | 19 | .PHONY: run run_chaos install bench -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/respond.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "respond.h" 3 | 4 | ssize_t respond(int fildes, const void *buf, size_t nbyte) { 5 | ssize_t written; 6 | // this is trying to address JIRA 70918 7 | // sometimes writes fail, so we just added a 2 retries 8 | for (int i = 0; i < 2; i++) { 9 | written = write(fildes, buf, nbyte); 10 | if (written > -1) { 11 | return written; 12 | } 13 | // TODO jira 70917 - if the first write doesn't work, try smaller chunks 14 | } 15 | return written; 16 | } -------------------------------------------------------------------------------- /examples/kubernetes/experiment2b.yml: -------------------------------------------------------------------------------- 1 | config: 2 | runStrategy: 3 | runs: 1 4 | scenarios: 5 | - name: Toxiproxy latency 6 | steps: 7 | - clone: 8 | source: 9 | deployment: 10 | name: goldpinger 11 | namespace: default 12 | replicas: 2 13 | mutations: 14 | - toxiproxy: 15 | toxics: 16 | - targetProxy: "8080" 17 | toxicType: latency 18 | toxicAttributes: 19 | - name: latency 20 | value: 250 21 | - wait: 22 | seconds: 120 23 | -------------------------------------------------------------------------------- /examples/busy-neighbours/mystery002-cgroups.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "Press [CTRL+C] to stop.." 3 | 4 | sudo cgcreate -g cpu:/formulaone 5 | sudo cgcreate -g cpu:/formulatwo 6 | 7 | # start some completely benign background daemon to do some __lightweight__work 8 | # ^ this simulates Alice's server's environment 9 | export dir=$(dirname "$(readlink -f "$0")") 10 | (sudo cgexec -g cpu:/formulatwo bash $dir/benign.sh)& 11 | 12 | # do the actual work 13 | while : 14 | do 15 | echo "Calculating pi's 3000 digits..." 16 | sudo cgexec -g cpu:/formulaone bash -c 'time echo "scale=3000; 4*a(1)" | bc -l | head -n1' 17 | done -------------------------------------------------------------------------------- /examples/killer-whiles/Makefile: -------------------------------------------------------------------------------- 1 | CFLAGS=-O0 2 | 3 | all: mystery000 mystery001 faas 4 | 5 | %.o: %.c 6 | cc -o $@ $< $(CFLAGS) 7 | 8 | faas: 9 | # link our fake faas services 10 | sudo ln -f -s /home/chaos/src/examples/killer-whiles/faas001_a.service /lib/systemd/system/faas001_a.service 11 | sudo ln -f -s /home/chaos/src/examples/killer-whiles/faas001_b.service /lib/systemd/system/faas001_b.service 12 | sudo systemctl daemon-reload 13 | # link our fake load-balancer 14 | sudo ln -f -s /home/chaos/src/examples/killer-whiles/nginx.loadbalancer.conf /etc/nginx/conf.d/nginx.loadbalancer.conf 15 | sudo systemctl restart nginx 16 | 17 | .PHONY: fass -------------------------------------------------------------------------------- /examples/poking-docker/meower-stack.yml: -------------------------------------------------------------------------------- 1 | version: '3.1' 2 | services: 3 | ghost: 4 | image: ghost:3.14.0-alpine 5 | ports: 6 | - 8080:2368 7 | environment: 8 | # see https://docs.ghost.org/docs/config#section-running-ghost-with-config-env-variables 9 | database__client: mysql 10 | database__connection__host: db 11 | database__connection__user: root 12 | database__connection__password: notverysafe 13 | database__connection__database: ghost 14 | server__host: "0.0.0.0" 15 | server__port: "2368" 16 | db: 17 | image: mysql:5.7 18 | environment: 19 | MYSQL_ROOT_PASSWORD: notverysafe 20 | -------------------------------------------------------------------------------- /vm/Makefile: -------------------------------------------------------------------------------- 1 | packer_bin ?= packer 2 | template_file ?= ./packer.json 3 | output_dir=./chaos-engineering-VM 4 | revision ?= $(shell git rev-parse HEAD) 5 | vm_name ?= chaos-engineering-VM-${revision} 6 | 7 | validate: 8 | ${packer_bin} validate ${template_file} 9 | 10 | build: validate 11 | ${packer_bin} build -on-error=ask ${template_file} 12 | ls -alh ${output_dir} 13 | 14 | package: 15 | shasum -a 256 ${output_dir}/* | tee chaos-engineering-VM.sha256 16 | zip -s 1g -sv ${vm_name}.zip ${output_dir}/* 17 | shasum -a 256 ${vm_name}* | tee parts.sha256 18 | ls -alh ${vm_name}* 19 | 20 | clean: 21 | rm -rf ${output_dir} 22 | 23 | .PHONY: validate build package clean 24 | -------------------------------------------------------------------------------- /examples/killer-whiles/cereal_killer.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Listing backend services" 4 | ps auxf | grep killer-whiles | grep python 5 | echo 6 | 7 | echo "Killing instance A (port 8001)" 8 | ps auxf | grep python | grep 8001 | awk '{system("sudo kill " $2)}' 9 | sleep 0.5 10 | systemctl status faas001_a --no-pager 11 | echo 12 | 13 | echo "Wait some time in-between killings" 14 | sleep 2 15 | echo 16 | 17 | echo "Killing instance B (port 8002)" 18 | ps auxf | grep python | grep 8002 | awk '{system("sudo kill " $2)}' 19 | sleep 0.5 20 | systemctl status faas001_b --no-pager 21 | echo 22 | 23 | echo "Listing backend services" 24 | ps auxf | grep killer-whiles | grep python 25 | echo "Done here!" 26 | -------------------------------------------------------------------------------- /examples/app/chaos.py: -------------------------------------------------------------------------------- 1 | import time 2 | import os 3 | 4 | 5 | class ChaosClient: 6 | def __init__(self, client, delay): 7 | self.client = client 8 | self.delay = delay 9 | def get(self, *args, **kwargs): 10 | time.sleep(self.delay) 11 | return self.client.get(*args, **kwargs) 12 | def set(self, *args, **kwargs): 13 | time.sleep(self.delay) 14 | return self.client.set(*args, **kwargs) 15 | 16 | def attach_chaos_if_enabled(cache_client): 17 | """ creates a wrapper class that delays calls to get and set methods """ 18 | if os.environ.get("CHAOS"): 19 | return ChaosClient(cache_client, float(os.environ.get("CHAOS_DELAY_SECONDS", 0.75))) 20 | return cache_client 21 | -------------------------------------------------------------------------------- /examples/jvm/org/agent/ClassPrinter.java: -------------------------------------------------------------------------------- 1 | package org.agent; 2 | 3 | import java.lang.instrument.ClassFileTransformer; 4 | import java.lang.instrument.IllegalClassFormatException; 5 | import java.security.ProtectionDomain; 6 | 7 | 8 | class ClassPrinter implements ClassFileTransformer { 9 | public byte[] transform(ClassLoader loader, 10 | String className, 11 | Class classBeingRedefined, 12 | ProtectionDomain protectionDomain, 13 | byte[] classfileBuffer) throws IllegalClassFormatException { 14 | System.out.println("Found class: " + className + " (" + classfileBuffer.length + " bytes)"); 15 | return classfileBuffer; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /examples/kubernetes/goldpinger-rbac.yml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: goldpinger-clusterrole 6 | rules: 7 | - apiGroups: 8 | - "" 9 | resources: 10 | - pods 11 | verbs: 12 | - list 13 | --- 14 | apiVersion: v1 15 | kind: ServiceAccount 16 | metadata: 17 | name: goldpinger-serviceaccount 18 | namespace: default 19 | --- 20 | apiVersion: rbac.authorization.k8s.io/v1 21 | kind: ClusterRoleBinding 22 | metadata: 23 | name: goldpinger-clusterrolebinding 24 | roleRef: 25 | apiGroup: rbac.authorization.k8s.io 26 | kind: ClusterRole 27 | name: goldpinger-clusterrole 28 | subjects: 29 | - kind: ServiceAccount 30 | name: goldpinger-serviceaccount 31 | namespace: default 32 | -------------------------------------------------------------------------------- /examples/killer-whiles/killer_while.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # restart instance A a few times, spaced out by 1.5 second delays 4 | i="0" 5 | while [ $i -le 5 ] 6 | do 7 | echo "Killing faas001_a ${i}th time" 8 | ps auxf | grep killer-whiles | grep python | grep 8001 | awk '{system("sudo kill " $2)}' 9 | sleep 1.25 10 | i=$[$i+1] 11 | done 12 | 13 | systemctl status faas001_a --no-pager 14 | 15 | sleep 2 16 | 17 | # restart instance B a few times, spaced out by 1.5 second delays 18 | i="0" 19 | while [ $i -le 5 ] 20 | do 21 | echo "Killing faas001_b ${i}th time" 22 | ps auxf | grep killer-whiles | grep python | grep 8002 | awk '{system("sudo kill " $2)}' 23 | sleep 1.25 24 | i=$[$i+1] 25 | done 26 | 27 | systemctl status faas001_b --no-pager 28 | -------------------------------------------------------------------------------- /examples/killer-whiles/mystery001.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main() 6 | { 7 | int wait = 1; 8 | int block_size = 64*1024*1024; 9 | int step = 1024*1024; 10 | char * allocated_block; 11 | 12 | while (1) { 13 | 14 | if ((allocated_block = (char*)malloc(block_size)) == NULL) { 15 | //printf("Couldn't malloc %d!\n", block_size); 16 | if (block_size > 2*step){ 17 | block_size -= step; 18 | } 19 | } else { 20 | // slowly write data to our newly allocated memory to actually claim it and use some CPU 21 | for (int i=0; i < block_size; i++){ 22 | *(allocated_block + i) = 'Y'; 23 | } 24 | } 25 | sleep(wait); 26 | } 27 | 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/seccomp.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | int main(void) 7 | { 8 | scmp_filter_ctx ctx; 9 | int rc; // note, that we totally avoid any error handling here... 10 | 11 | // disable everything by default, by returning EPERM (not allowed) 12 | ctx = seccomp_init(SCMP_ACT_ERRNO(EPERM)); 13 | // allow write... 14 | rc = seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(write), 0); 15 | // and exit - otherwise it would segfault on exit 16 | rc = seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(exit), 0); 17 | // load the profile 18 | rc = seccomp_load(ctx); 19 | 20 | // write should succeed, but the pid will not 21 | fprintf(stdout, "getpid() == %d\n", getpid()); 22 | 23 | // release the seccomp context 24 | seccomp_release(ctx); 25 | } 26 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/Makefile: -------------------------------------------------------------------------------- 1 | CC=cc 2 | CFLAGS=-O0 3 | SRC=$(shell find . -name "*.c") 4 | HEADERS=$(shell find . -name "*.h") 5 | OBJ=$(shell find . -name "*.h" | sed 's/\.h/\.o/g') 6 | TARGET=legacy_server 7 | MAIN=main.c 8 | 9 | all: $(TARGET) 10 | 11 | %.o: %.c 12 | $(CC) $(CFLAGS) -c -o $@ $< 13 | 14 | $(TARGET): $(HEADERS) $(OBJ) $(MAIN) $(SRC) 15 | $(CC) $(CFLAGS) -o $(TARGET) $(OBJ) $(MAIN) 16 | cp $(TARGET) ~ 17 | 18 | clean: 19 | rm $(OBJ) $(TARGET) 20 | 21 | run: gen $(TARGET) 22 | ./$(TARGET) 23 | 24 | gen: 25 | ./generate_legacy.py 26 | 27 | tag ?= legacy 28 | 29 | docker-build: 30 | docker build -t ${tag} . 31 | 32 | docker-run: 33 | docker run --rm --name legacy -ti --security-opt seccomp=../profile.json -p 8080:8080 ${tag} 34 | 35 | profile: 36 | curl https://raw.githubusercontent.com/moby/moby/master/profiles/seccomp/default.json | grep -v getpid > profile.json 37 | 38 | .PHONY: clean run gen docker-build docker-run 39 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/grpc_2.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "grpc_2.h" 4 | #include 5 | 6 | ssize_t grpc_2(int fd) { 7 | char a = 59, grpc_2_b = 29, grpc_2_grpc_2 = 29; 8 | for (int i = 0; i < 3; i++){ 9 | a++; grpc_2_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | grpc_2_grpc_2 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &grpc_2_b, sizeof(a)); // maybe should be grpc_2_b? It wouldn't compile 22 | ssize_t r = respond(fd, &grpc_2_grpc_2, sizeof(grpc_2_grpc_2)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | ; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/ai_0.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "big_data_0.h" 4 | #include 5 | 6 | ssize_t ai_0(int fd) { 7 | char a = 118, ai_0_b = 109, ai_0_ai_0 = 98; 8 | for (int i = 0; i < 3; i++){ 9 | a++; ai_0_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | ai_0_ai_0 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &ai_0_b, sizeof(a)); // maybe should be ai_0_b? It wouldn't compile 22 | ssize_t r = respond(fd, &ai_0_ai_0, sizeof(ai_0_ai_0)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) big_data_0(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/ai_1.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "big_data_1.h" 4 | #include 5 | 6 | ssize_t ai_1(int fd) { 7 | char a = 108, ai_1_b = 104, ai_1_ai_1 = 102; 8 | for (int i = 0; i < 3; i++){ 9 | a++; ai_1_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | ai_1_ai_1 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &ai_1_b, sizeof(a)); // maybe should be ai_1_b? It wouldn't compile 22 | ssize_t r = respond(fd, &ai_1_ai_1, sizeof(ai_1_ai_1)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) big_data_1(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/ai_2.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "big_data_2.h" 4 | #include 5 | 6 | ssize_t ai_2(int fd) { 7 | char a = 111, ai_2_b = 98, ai_2_ai_2 = 31; 8 | for (int i = 0; i < 3; i++){ 9 | a++; ai_2_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | ai_2_ai_2 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &ai_2_b, sizeof(a)); // maybe should be ai_2_b? It wouldn't compile 22 | ssize_t r = respond(fd, &ai_2_ai_2, sizeof(ai_2_ai_2)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) big_data_2(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/grpc_0.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "iaas_0.h" 4 | #include 5 | 6 | ssize_t grpc_0(int fd) { 7 | char a = 105, grpc_0_b = 98, grpc_0_grpc_0 = 59; 8 | for (int i = 0; i < 3; i++){ 9 | a++; grpc_0_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | grpc_0_grpc_0 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &grpc_0_b, sizeof(a)); // maybe should be grpc_0_b? It wouldn't compile 22 | ssize_t r = respond(fd, &grpc_0_grpc_0, sizeof(grpc_0_grpc_0)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) iaas_0(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/grpc_1.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "iaas_1.h" 4 | #include 5 | 6 | ssize_t grpc_1(int fd) { 7 | char a = 31, grpc_1_b = 29, grpc_1_grpc_1 = 94; 8 | for (int i = 0; i < 3; i++){ 9 | a++; grpc_1_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | grpc_1_grpc_1 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &grpc_1_b, sizeof(a)); // maybe should be grpc_1_b? It wouldn't compile 22 | ssize_t r = respond(fd, &grpc_1_grpc_1, sizeof(grpc_1_grpc_1)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) iaas_1(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/paas_0.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "pivot_0.h" 4 | #include 5 | 6 | ssize_t paas_0(int fd) { 7 | char a = 101, paas_0_b = 98, paas_0_paas_0 = 102; 8 | for (int i = 0; i < 3; i++){ 9 | a++; paas_0_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | paas_0_paas_0 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &paas_0_b, sizeof(a)); // maybe should be paas_0_b? It wouldn't compile 22 | ssize_t r = respond(fd, &paas_0_paas_0, sizeof(paas_0_paas_0)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) pivot_0(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/paas_1.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "pivot_1.h" 4 | #include 5 | 6 | ssize_t paas_1(int fd) { 7 | char a = 96, paas_1_b = 111, paas_1_paas_1 = 118; 8 | for (int i = 0; i < 3; i++){ 9 | a++; paas_1_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | paas_1_paas_1 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &paas_1_b, sizeof(a)); // maybe should be paas_1_b? It wouldn't compile 22 | ssize_t r = respond(fd, &paas_1_paas_1, sizeof(paas_1_paas_1)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) pivot_1(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/agile_0.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "ai_0.h" 4 | #include 5 | 6 | ssize_t agile_0(int fd) { 7 | char a = 108, agile_0_b = 96, agile_0_agile_0 = 113; 8 | for (int i = 0; i < 3; i++){ 9 | a++; agile_0_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | agile_0_agile_0 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &agile_0_b, sizeof(a)); // maybe should be agile_0_b? It wouldn't compile 22 | ssize_t r = respond(fd, &agile_0_agile_0, sizeof(agile_0_agile_0)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) ai_0(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/agile_1.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "ai_1.h" 4 | #include 5 | 6 | ssize_t agile_1(int fd) { 7 | char a = 108, agile_1_b = 96, agile_1_agile_1 = 108; 8 | for (int i = 0; i < 3; i++){ 9 | a++; agile_1_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | agile_1_agile_1 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &agile_1_b, sizeof(a)); // maybe should be agile_1_b? It wouldn't compile 22 | ssize_t r = respond(fd, &agile_1_agile_1, sizeof(agile_1_agile_1)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) ai_1(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/agile_2.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "ai_2.h" 4 | #include 5 | 6 | ssize_t agile_2(int fd) { 7 | char a = 96, agile_2_b = 113, agile_2_agile_2 = 114; 8 | for (int i = 0; i < 3; i++){ 9 | a++; agile_2_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | agile_2_agile_2 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &agile_2_b, sizeof(a)); // maybe should be agile_2_b? It wouldn't compile 22 | ssize_t r = respond(fd, &agile_2_agile_2, sizeof(agile_2_agile_2)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) ai_2(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/saas_0.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "scalability_0.h" 4 | #include 5 | 6 | ssize_t saas_0(int fd) { 7 | char a = 96, saas_0_b = 58, saas_0_saas_0 = 31; 8 | for (int i = 0; i < 3; i++){ 9 | a++; saas_0_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | saas_0_saas_0 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &saas_0_b, sizeof(a)); // maybe should be saas_0_b? It wouldn't compile 22 | ssize_t r = respond(fd, &saas_0_saas_0, sizeof(saas_0_saas_0)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) scalability_0(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/saas_1.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "scalability_1.h" 4 | #include 5 | 6 | ssize_t saas_1(int fd) { 7 | char a = 100, saas_1_b = 118, saas_1_saas_1 = 111; 8 | for (int i = 0; i < 3; i++){ 9 | a++; saas_1_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | saas_1_saas_1 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &saas_1_b, sizeof(a)); // maybe should be saas_1_b? It wouldn't compile 22 | ssize_t r = respond(fd, &saas_1_saas_1, sizeof(saas_1_saas_1)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) scalability_1(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/cloud_0.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "container_0.h" 4 | #include 5 | 6 | ssize_t cloud_0(int fd) { 7 | char a = 106, cloud_0_b = 105, cloud_0_cloud_0 = 59; 8 | for (int i = 0; i < 3; i++){ 9 | a++; cloud_0_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | cloud_0_cloud_0 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &cloud_0_b, sizeof(a)); // maybe should be cloud_0_b? It wouldn't compile 22 | ssize_t r = respond(fd, &cloud_0_cloud_0, sizeof(cloud_0_cloud_0)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) container_0(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/cloud_1.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "container_1.h" 4 | #include 5 | 6 | ssize_t cloud_1(int fd) { 7 | char a = 98, cloud_1_b = 97, cloud_1_cloud_1 = 44; 8 | for (int i = 0; i < 3; i++){ 9 | a++; cloud_1_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | cloud_1_cloud_1 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &cloud_1_b, sizeof(a)); // maybe should be cloud_1_b? It wouldn't compile 22 | ssize_t r = respond(fd, &cloud_1_cloud_1, sizeof(cloud_1_cloud_1)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) container_1(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/cloud_2.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "container_2.h" 4 | #include 5 | 6 | ssize_t cloud_2(int fd) { 7 | char a = 105, cloud_2_b = 112, cloud_2_cloud_2 = 96; 8 | for (int i = 0; i < 3; i++){ 9 | a++; cloud_2_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | cloud_2_cloud_2 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &cloud_2_b, sizeof(a)); // maybe should be cloud_2_b? It wouldn't compile 22 | ssize_t r = respond(fd, &cloud_2_cloud_2, sizeof(cloud_2_cloud_2)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) container_2(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/lean_0.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "machine_learning_0.h" 4 | #include 5 | 6 | ssize_t lean_0(int fd) { 7 | char a = 59, lean_0_b = 57, lean_0_lean_0 = 95; 8 | for (int i = 0; i < 3; i++){ 9 | a++; lean_0_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | lean_0_lean_0 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &lean_0_b, sizeof(a)); // maybe should be lean_0_b? It wouldn't compile 22 | ssize_t r = respond(fd, &lean_0_lean_0, sizeof(lean_0_lean_0)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) machine_learning_0(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/lean_1.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "machine_learning_1.h" 4 | #include 5 | 6 | ssize_t lean_1(int fd) { 7 | char a = 94, lean_1_b = 96, lean_1_lean_1 = 96; 8 | for (int i = 0; i < 3; i++){ 9 | a++; lean_1_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | lean_1_lean_1 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &lean_1_b, sizeof(a)); // maybe should be lean_1_b? It wouldn't compile 22 | ssize_t r = respond(fd, &lean_1_lean_1, sizeof(lean_1_lean_1)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) machine_learning_1(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/iaas_0.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "internet_of_things_0.h" 4 | #include 5 | 6 | ssize_t iaas_0(int fd) { 7 | char a = 57, iaas_0_b = 44, iaas_0_iaas_0 = 101; 8 | for (int i = 0; i < 3; i++){ 9 | a++; iaas_0_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | iaas_0_iaas_0 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &iaas_0_b, sizeof(a)); // maybe should be iaas_0_b? It wouldn't compile 22 | ssize_t r = respond(fd, &iaas_0_iaas_0, sizeof(iaas_0_iaas_0)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) internet_of_things_0(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/iaas_1.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "internet_of_things_1.h" 4 | #include 5 | 6 | ssize_t iaas_1(int fd) { 7 | char a = 105, iaas_1_b = 105, iaas_1_iaas_1 = 108; 8 | for (int i = 0; i < 3; i++){ 9 | a++; iaas_1_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | iaas_1_iaas_1 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &iaas_1_b, sizeof(a)); // maybe should be iaas_1_b? It wouldn't compile 22 | ssize_t r = respond(fd, &iaas_1_iaas_1, sizeof(iaas_1_iaas_1)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) internet_of_things_1(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/new_4g_0.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "next_gen_0.h" 4 | #include 5 | 6 | ssize_t new_4g_0(int fd) { 7 | char a = 113, new_4g_0_b = 101, new_4g_0_new_4g_0 = 58; 8 | for (int i = 0; i < 3; i++){ 9 | a++; new_4g_0_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | new_4g_0_new_4g_0 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &new_4g_0_b, sizeof(a)); // maybe should be new_4g_0_b? It wouldn't compile 22 | ssize_t r = respond(fd, &new_4g_0_new_4g_0, sizeof(new_4g_0_new_4g_0)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) next_gen_0(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/pivot_0.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "preprocessing_0.h" 4 | #include 5 | 6 | ssize_t pivot_0(int fd) { 7 | char a = 100, pivot_0_b = 101, pivot_0_pivot_0 = 113; 8 | for (int i = 0; i < 3; i++){ 9 | a++; pivot_0_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | pivot_0_pivot_0 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &pivot_0_b, sizeof(a)); // maybe should be pivot_0_b? It wouldn't compile 22 | ssize_t r = respond(fd, &pivot_0_pivot_0, sizeof(pivot_0_pivot_0)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) preprocessing_0(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/pivot_1.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "preprocessing_1.h" 4 | #include 5 | 6 | ssize_t pivot_1(int fd) { 7 | char a = 109, pivot_1_b = 113, pivot_1_pivot_1 = 98; 8 | for (int i = 0; i < 3; i++){ 9 | a++; pivot_1_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | pivot_1_pivot_1 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &pivot_1_b, sizeof(a)); // maybe should be pivot_1_b? It wouldn't compile 22 | ssize_t r = respond(fd, &pivot_1_pivot_1, sizeof(pivot_1_pivot_1)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) preprocessing_1(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/crypto_0.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "data_mining_0.h" 4 | #include 5 | 6 | ssize_t crypto_0(int fd) { 7 | char a = 94, crypto_0_b = 97, crypto_0_crypto_0 = 59; 8 | for (int i = 0; i < 3; i++){ 9 | a++; crypto_0_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | crypto_0_crypto_0 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &crypto_0_b, sizeof(a)); // maybe should be crypto_0_b? It wouldn't compile 22 | ssize_t r = respond(fd, &crypto_0_crypto_0, sizeof(crypto_0_crypto_0)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) data_mining_0(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/crypto_1.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "data_mining_1.h" 4 | #include 5 | 6 | ssize_t crypto_1(int fd) { 7 | char a = 49, crypto_1_b = 116, crypto_1_crypto_1 = 54; 8 | for (int i = 0; i < 3; i++){ 9 | a++; crypto_1_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | crypto_1_crypto_1 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &crypto_1_b, sizeof(a)); // maybe should be crypto_1_b? It wouldn't compile 22 | ssize_t r = respond(fd, &crypto_1_crypto_1, sizeof(crypto_1_crypto_1)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) data_mining_1(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/crypto_2.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "data_mining_2.h" 4 | #include 5 | 6 | ssize_t crypto_2(int fd) { 7 | char a = 107, crypto_2_b = 59, crypto_2_crypto_2 = 57; 8 | for (int i = 0; i < 3; i++){ 9 | a++; crypto_2_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | crypto_2_crypto_2 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &crypto_2_b, sizeof(a)); // maybe should be crypto_2_b? It wouldn't compile 22 | ssize_t r = respond(fd, &crypto_2_crypto_2, sizeof(crypto_2_crypto_2)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) data_mining_2(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/new_4g_1.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "next_gen_1.h" 4 | #include 5 | 6 | ssize_t new_4g_1(int fd) { 7 | char a = 108, new_4g_1_b = 109, new_4g_1_new_4g_1 = 105; 8 | for (int i = 0; i < 3; i++){ 9 | a++; new_4g_1_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | new_4g_1_new_4g_1 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &new_4g_1_b, sizeof(a)); // maybe should be new_4g_1_b? It wouldn't compile 22 | ssize_t r = respond(fd, &new_4g_1_new_4g_1, sizeof(new_4g_1_new_4g_1)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) next_gen_1(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/organic_0.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "paas_0.h" 4 | #include 5 | 6 | ssize_t organic_0(int fd) { 7 | char a = 45, organic_0_b = 31, organic_0_organic_0 = 29; 8 | for (int i = 0; i < 3; i++){ 9 | a++; organic_0_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | organic_0_organic_0 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &organic_0_b, sizeof(a)); // maybe should be organic_0_b? It wouldn't compile 22 | ssize_t r = respond(fd, &organic_0_organic_0, sizeof(organic_0_organic_0)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) paas_0(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/organic_1.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "paas_1.h" 4 | #include 5 | 6 | ssize_t organic_1(int fd) { 7 | char a = 29, organic_1_b = 98, organic_1_organic_1 = 107; 8 | for (int i = 0; i < 3; i++){ 9 | a++; organic_1_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | organic_1_organic_1 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &organic_1_b, sizeof(a)); // maybe should be organic_1_b? It wouldn't compile 22 | ssize_t r = respond(fd, &organic_1_organic_1, sizeof(organic_1_organic_1)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) paas_1(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/poking-docker/container-ish-2.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | set +x 3 | 4 | CURRENT_DIRECTORY="$(dirname "${0}")" 5 | 6 | CPU_LIMIT=${1:-50000} 7 | RAM_LIMIT=${2:-5242880} 8 | 9 | echo "Step A: generate a unique ID (uuid)" 10 | UUID=$(date | sha256sum | cut -f1 -d" ") 11 | 12 | echo "Step B: create cpu and memory cgroups" 13 | sudo mkdir /sys/fs/cgroup/{cpu,memory}/$UUID 14 | echo $RAM_LIMIT | sudo tee /sys/fs/cgroup/memory/$UUID/memory.limit_in_bytes 15 | echo 100000 | sudo tee /sys/fs/cgroup/cpu/$UUID/cpu.cfs_period_us 16 | echo $CPU_LIMIT | sudo tee /sys/fs/cgroup/cpu/$UUID/cpu.cfs_quota_us 17 | 18 | echo "Step C: prepare the folder structure to be our chroot" 19 | bash $CURRENT_DIRECTORY/new-filesystem.sh $UUID > /dev/null && cd $UUID 20 | 21 | echo "Step D: put the current process (PID $$) into the cgroups" 22 | echo $$ | sudo tee /sys/fs/cgroup/{cpu,memory}/$UUID/tasks 23 | 24 | echo "Step E: start our namespaced chroot container-ish: $UUID" 25 | sudo unshare \ 26 | --fork \ 27 | --pid \ 28 | chroot . \ 29 | /bin/bash -c "mkdir -p /proc && /bin/mount -t proc proc /proc && exec /bin/bash" 30 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/disrupt_0.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "emulator_0.h" 4 | #include 5 | 6 | ssize_t disrupt_0(int fd) { 7 | char a = 59, disrupt_0_b = 79, disrupt_0_disrupt_0 = 102; 8 | for (int i = 0; i < 3; i++){ 9 | a++; disrupt_0_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | disrupt_0_disrupt_0 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &disrupt_0_b, sizeof(a)); // maybe should be disrupt_0_b? It wouldn't compile 22 | ssize_t r = respond(fd, &disrupt_0_disrupt_0, sizeof(disrupt_0_disrupt_0)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) emulator_0(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/disrupt_1.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "emulator_1.h" 4 | #include 5 | 6 | ssize_t disrupt_1(int fd) { 7 | char a = 29, disrupt_1_b = 99, disrupt_1_disrupt_1 = 111; 8 | for (int i = 0; i < 3; i++){ 9 | a++; disrupt_1_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | disrupt_1_disrupt_1 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &disrupt_1_b, sizeof(a)); // maybe should be disrupt_1_b? It wouldn't compile 22 | ssize_t r = respond(fd, &disrupt_1_disrupt_1, sizeof(disrupt_1_disrupt_1)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) emulator_1(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/disrupt_2.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "emulator_2.h" 4 | #include 5 | 6 | ssize_t disrupt_2(int fd) { 7 | char a = 98, disrupt_2_b = 59, disrupt_2_disrupt_2 = 57; 8 | for (int i = 0; i < 3; i++){ 9 | a++; disrupt_2_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | disrupt_2_disrupt_2 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &disrupt_2_b, sizeof(a)); // maybe should be disrupt_2_b? It wouldn't compile 22 | ssize_t r = respond(fd, &disrupt_2_disrupt_2, sizeof(disrupt_2_disrupt_2)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) emulator_2(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/fission_0.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "free_range_0.h" 4 | #include 5 | 6 | ssize_t fission_0(int fd) { 7 | char a = 30, fission_0_b = 57, fission_0_fission_0 = 44; 8 | for (int i = 0; i < 3; i++){ 9 | a++; fission_0_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | fission_0_fission_0 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &fission_0_b, sizeof(a)); // maybe should be fission_0_b? It wouldn't compile 22 | ssize_t r = respond(fd, &fission_0_fission_0, sizeof(fission_0_fission_0)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) free_range_0(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/fission_1.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "free_range_1.h" 4 | #include 5 | 6 | ssize_t fission_1(int fd) { 7 | char a = 97, fission_1_b = 98, fission_1_fission_1 = 111; 8 | for (int i = 0; i < 3; i++){ 9 | a++; fission_1_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | fission_1_fission_1 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &fission_1_b, sizeof(a)); // maybe should be fission_1_b? It wouldn't compile 22 | ssize_t r = respond(fd, &fission_1_fission_1, sizeof(fission_1_fission_1)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) free_range_1(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/fission_2.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "free_range_2.h" 4 | #include 5 | 6 | ssize_t fission_2(int fd) { 7 | char a = 57, fission_2_b = 44, fission_2_fission_2 = 101; 8 | for (int i = 0; i < 3; i++){ 9 | a++; fission_2_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | fission_2_fission_2 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &fission_2_b, sizeof(a)); // maybe should be fission_2_b? It wouldn't compile 22 | ssize_t r = respond(fd, &fission_2_fission_2, sizeof(fission_2_fission_2)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) free_range_2(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/next_gen_0.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "organic_0.h" 4 | #include 5 | 6 | ssize_t next_gen_0(int fd) { 7 | char a = 31, next_gen_0_b = 50, next_gen_0_next_gen_0 = 51; 8 | for (int i = 0; i < 3; i++){ 9 | a++; next_gen_0_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | next_gen_0_next_gen_0 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &next_gen_0_b, sizeof(a)); // maybe should be next_gen_0_b? It wouldn't compile 22 | ssize_t r = respond(fd, &next_gen_0_next_gen_0, sizeof(next_gen_0_next_gen_0)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) organic_0(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/next_gen_1.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "organic_1.h" 4 | #include 5 | 6 | ssize_t next_gen_1(int fd) { 7 | char a = 94, next_gen_1_b = 118, next_gen_1_next_gen_1 = 56; 8 | for (int i = 0; i < 3; i++){ 9 | a++; next_gen_1_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | next_gen_1_next_gen_1 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &next_gen_1_b, sizeof(a)); // maybe should be next_gen_1_b? It wouldn't compile 22 | ssize_t r = respond(fd, &next_gen_1_next_gen_1, sizeof(next_gen_1_next_gen_1)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) organic_1(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/unicorn_0.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "virtualization_0.h" 4 | #include 5 | 6 | ssize_t unicorn_0(int fd) { 7 | char a = 44, unicorn_0_b = 44, unicorn_0_unicorn_0 = 116; 8 | for (int i = 0; i < 3; i++){ 9 | a++; unicorn_0_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | unicorn_0_unicorn_0 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &unicorn_0_b, sizeof(a)); // maybe should be unicorn_0_b? It wouldn't compile 22 | ssize_t r = respond(fd, &unicorn_0_unicorn_0, sizeof(unicorn_0_unicorn_0)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) virtualization_0(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/unicorn_1.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "virtualization_1.h" 4 | #include 5 | 6 | ssize_t unicorn_1(int fd) { 7 | char a = 56, unicorn_1_b = 29, unicorn_1_unicorn_1 = 109; 8 | for (int i = 0; i < 3; i++){ 9 | a++; unicorn_1_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | unicorn_1_unicorn_1 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &unicorn_1_b, sizeof(a)); // maybe should be unicorn_1_b? It wouldn't compile 22 | ssize_t r = respond(fd, &unicorn_1_unicorn_1, sizeof(unicorn_1_unicorn_1)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) virtualization_1(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/monolith_0.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "networking_0.h" 4 | #include 5 | 6 | ssize_t monolith_0(int fd) { 7 | char a = 106, monolith_0_b = 98, monolith_0_monolith_0 = 29; 8 | for (int i = 0; i < 3; i++){ 9 | a++; monolith_0_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | monolith_0_monolith_0 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &monolith_0_b, sizeof(a)); // maybe should be monolith_0_b? It wouldn't compile 22 | ssize_t r = respond(fd, &monolith_0_monolith_0, sizeof(monolith_0_monolith_0)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) networking_0(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/monolith_1.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "networking_1.h" 4 | #include 5 | 6 | ssize_t monolith_1(int fd) { 7 | char a = 111, monolith_1_b = 56, monolith_1_monolith_1 = 29; 8 | for (int i = 0; i < 3; i++){ 9 | a++; monolith_1_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | monolith_1_monolith_1 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &monolith_1_b, sizeof(a)); // maybe should be monolith_1_b? It wouldn't compile 22 | ssize_t r = respond(fd, &monolith_1_monolith_1, sizeof(monolith_1_monolith_1)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) networking_1(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/big_data_0.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "bleeding_edge_0.h" 4 | #include 5 | 6 | ssize_t big_data_0(int fd) { 7 | char a = 29, big_data_0_b = 101, big_data_0_big_data_0 = 113; 8 | for (int i = 0; i < 3; i++){ 9 | a++; big_data_0_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | big_data_0_big_data_0 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &big_data_0_b, sizeof(a)); // maybe should be big_data_0_b? It wouldn't compile 22 | ssize_t r = respond(fd, &big_data_0_big_data_0, sizeof(big_data_0_big_data_0)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) bleeding_edge_0(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/big_data_1.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "bleeding_edge_1.h" 4 | #include 5 | 6 | ssize_t big_data_1(int fd) { 7 | char a = 98, big_data_1_b = 43, big_data_1_big_data_1 = 96; 8 | for (int i = 0; i < 3; i++){ 9 | a++; big_data_1_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | big_data_1_big_data_1 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &big_data_1_b, sizeof(a)); // maybe should be big_data_1_b? It wouldn't compile 22 | ssize_t r = respond(fd, &big_data_1_big_data_1, sizeof(big_data_1_big_data_1)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) bleeding_edge_1(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/big_data_2.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "bleeding_edge_2.h" 4 | #include 5 | 6 | ssize_t big_data_2(int fd) { 7 | char a = 29, big_data_2_b = 94, big_data_2_big_data_2 = 105; 8 | for (int i = 0; i < 3; i++){ 9 | a++; big_data_2_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | big_data_2_big_data_2 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &big_data_2_b, sizeof(a)); // maybe should be big_data_2_b? It wouldn't compile 22 | ssize_t r = respond(fd, &big_data_2_big_data_2, sizeof(big_data_2_big_data_2)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) bleeding_edge_2(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/container_0.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "crypto_0.h" 4 | #include 5 | 6 | ssize_t container_0(int fd) { 7 | char a = 57, container_0_b = 101, container_0_container_0 = 98; 8 | for (int i = 0; i < 3; i++){ 9 | a++; container_0_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | container_0_container_0 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &container_0_b, sizeof(a)); // maybe should be container_0_b? It wouldn't compile 22 | ssize_t r = respond(fd, &container_0_container_0, sizeof(container_0_container_0)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) crypto_0(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/container_1.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "crypto_1.h" 4 | #include 5 | 6 | ssize_t container_1(int fd) { 7 | char a = 97, container_1_b = 78, container_1_container_1 = 116; 8 | for (int i = 0; i < 3; i++){ 9 | a++; container_1_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | container_1_container_1 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &container_1_b, sizeof(a)); // maybe should be container_1_b? It wouldn't compile 22 | ssize_t r = respond(fd, &container_1_container_1, sizeof(container_1_container_1)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) crypto_1(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/container_2.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "crypto_2.h" 4 | #include 5 | 6 | ssize_t container_2(int fd) { 7 | char a = 111, container_2_b = 98, container_2_container_2 = 98; 8 | for (int i = 0; i < 3; i++){ 9 | a++; container_2_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | container_2_container_2 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &container_2_b, sizeof(a)); // maybe should be container_2_b? It wouldn't compile 22 | ssize_t r = respond(fd, &container_2_container_2, sizeof(container_2_container_2)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) crypto_2(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/deep_dive_0.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "disrupt_0.h" 4 | #include 5 | 6 | ssize_t deep_dive_0(int fd) { 7 | char a = 113, deep_dive_0_b = 105, deep_dive_0_deep_dive_0 = 98; 8 | for (int i = 0; i < 3; i++){ 9 | a++; deep_dive_0_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | deep_dive_0_deep_dive_0 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &deep_dive_0_b, sizeof(a)); // maybe should be deep_dive_0_b? It wouldn't compile 22 | ssize_t r = respond(fd, &deep_dive_0_deep_dive_0, sizeof(deep_dive_0_deep_dive_0)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) disrupt_0(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/deep_dive_1.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "disrupt_1.h" 4 | #include 5 | 6 | ssize_t deep_dive_1(int fd) { 7 | char a = 96, deep_dive_1_b = 78, deep_dive_1_deep_dive_1 = 31; 8 | for (int i = 0; i < 3; i++){ 9 | a++; deep_dive_1_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | deep_dive_1_deep_dive_1 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &deep_dive_1_b, sizeof(a)); // maybe should be deep_dive_1_b? It wouldn't compile 22 | ssize_t r = respond(fd, &deep_dive_1_deep_dive_1, sizeof(deep_dive_1_deep_dive_1)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) disrupt_1(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/deep_dive_2.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "disrupt_2.h" 4 | #include 5 | 6 | ssize_t deep_dive_2(int fd) { 7 | char a = 111, deep_dive_2_b = 94, deep_dive_2_deep_dive_2 = 106; 8 | for (int i = 0; i < 3; i++){ 9 | a++; deep_dive_2_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | deep_dive_2_deep_dive_2 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &deep_dive_2_b, sizeof(a)); // maybe should be deep_dive_2_b? It wouldn't compile 22 | ssize_t r = respond(fd, &deep_dive_2_deep_dive_2, sizeof(deep_dive_2_deep_dive_2)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) disrupt_2(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/emulator_0.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "enterprise_ready_0.h" 4 | #include 5 | 6 | ssize_t emulator_0(int fd) { 7 | char a = 96, emulator_0_b = 104, emulator_0_emulator_0 = 111; 8 | for (int i = 0; i < 3; i++){ 9 | a++; emulator_0_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | emulator_0_emulator_0 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &emulator_0_b, sizeof(a)); // maybe should be emulator_0_b? It wouldn't compile 22 | ssize_t r = respond(fd, &emulator_0_emulator_0, sizeof(emulator_0_emulator_0)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) enterprise_ready_0(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/emulator_1.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "enterprise_ready_1.h" 4 | #include 5 | 6 | ssize_t emulator_1(int fd) { 7 | char a = 94, emulator_1_b = 106, emulator_1_emulator_1 = 98; 8 | for (int i = 0; i < 3; i++){ 9 | a++; emulator_1_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | emulator_1_emulator_1 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &emulator_1_b, sizeof(a)); // maybe should be emulator_1_b? It wouldn't compile 22 | ssize_t r = respond(fd, &emulator_1_emulator_1, sizeof(emulator_1_emulator_1)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) enterprise_ready_1(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/emulator_2.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "enterprise_ready_2.h" 4 | #include 5 | 6 | ssize_t emulator_2(int fd) { 7 | char a = 44, emulator_2_b = 95, emulator_2_emulator_2 = 108; 8 | for (int i = 0; i < 3; i++){ 9 | a++; emulator_2_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | emulator_2_emulator_2 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &emulator_2_b, sizeof(a)); // maybe should be emulator_2_b? It wouldn't compile 22 | ssize_t r = respond(fd, &emulator_2_emulator_2, sizeof(emulator_2_emulator_2)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) enterprise_ready_2(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/blockchain_0.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "cloud_0.h" 4 | #include 5 | 6 | ssize_t blockchain_0(int fd) { 7 | char a = 57, blockchain_0_b = 101, blockchain_0_blockchain_0 = 113; 8 | for (int i = 0; i < 3; i++){ 9 | a++; blockchain_0_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | blockchain_0_blockchain_0 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &blockchain_0_b, sizeof(a)); // maybe should be blockchain_0_b? It wouldn't compile 22 | ssize_t r = respond(fd, &blockchain_0_blockchain_0, sizeof(blockchain_0_blockchain_0)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) cloud_0(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/blockchain_1.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "cloud_1.h" 4 | #include 5 | 6 | ssize_t blockchain_1(int fd) { 7 | char a = 98, blockchain_1_b = 106, blockchain_1_blockchain_1 = 95; 8 | for (int i = 0; i < 3; i++){ 9 | a++; blockchain_1_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | blockchain_1_blockchain_1 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &blockchain_1_b, sizeof(a)); // maybe should be blockchain_1_b? It wouldn't compile 22 | ssize_t r = respond(fd, &blockchain_1_blockchain_1, sizeof(blockchain_1_blockchain_1)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) cloud_1(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/blockchain_2.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "cloud_2.h" 4 | #include 5 | 6 | ssize_t blockchain_2(int fd) { 7 | char a = 99, blockchain_2_b = 114, blockchain_2_blockchain_2 = 105; 8 | for (int i = 0; i < 3; i++){ 9 | a++; blockchain_2_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | blockchain_2_blockchain_2 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &blockchain_2_b, sizeof(a)); // maybe should be blockchain_2_b? It wouldn't compile 22 | ssize_t r = respond(fd, &blockchain_2_blockchain_2, sizeof(blockchain_2_blockchain_2)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) cloud_2(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/free_range_0.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "grpc_0.h" 4 | #include 5 | 6 | ssize_t free_range_0(int fd) { 7 | char a = 113, free_range_0_b = 102, free_range_0_free_range_0 = 113; 8 | for (int i = 0; i < 3; i++){ 9 | a++; free_range_0_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | free_range_0_free_range_0 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &free_range_0_b, sizeof(a)); // maybe should be free_range_0_b? It wouldn't compile 22 | ssize_t r = respond(fd, &free_range_0_free_range_0, sizeof(free_range_0_free_range_0)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) grpc_0(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/free_range_1.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "grpc_1.h" 4 | #include 5 | 6 | ssize_t free_range_1(int fd) { 7 | char a = 58, free_range_1_b = 31, free_range_1_free_range_1 = 45; 8 | for (int i = 0; i < 3; i++){ 9 | a++; free_range_1_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | free_range_1_free_range_1 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &free_range_1_b, sizeof(a)); // maybe should be free_range_1_b? It wouldn't compile 22 | ssize_t r = respond(fd, &free_range_1_free_range_1, sizeof(free_range_1_free_range_1)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) grpc_1(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/free_range_2.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "grpc_2.h" 4 | #include 5 | 6 | ssize_t free_range_2(int fd) { 7 | char a = 113, free_range_2_b = 106, free_range_2_free_range_2 = 105; 8 | for (int i = 0; i < 3; i++){ 9 | a++; free_range_2_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | free_range_2_free_range_2 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &free_range_2_b, sizeof(a)); // maybe should be free_range_2_b? It wouldn't compile 22 | ssize_t r = respond(fd, &free_range_2_free_range_2, sizeof(free_range_2_free_range_2)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) grpc_2(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/web_scale_0.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "abandonware_1.h" 4 | #include 5 | 6 | ssize_t web_scale_0(int fd) { 7 | char a = 118, web_scale_0_b = 108, web_scale_0_web_scale_0 = 114; 8 | for (int i = 0; i < 3; i++){ 9 | a++; web_scale_0_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | web_scale_0_web_scale_0 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &web_scale_0_b, sizeof(a)); // maybe should be web_scale_0_b? It wouldn't compile 22 | ssize_t r = respond(fd, &web_scale_0_web_scale_0, sizeof(web_scale_0_web_scale_0)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) abandonware_1(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/web_scale_1.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "abandonware_2.h" 4 | #include 5 | 6 | ssize_t web_scale_1(int fd) { 7 | char a = 114, web_scale_1_b = 111, web_scale_1_web_scale_1 = 98; 8 | for (int i = 0; i < 3; i++){ 9 | a++; web_scale_1_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | web_scale_1_web_scale_1 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &web_scale_1_b, sizeof(a)); // maybe should be web_scale_1_b? It wouldn't compile 22 | ssize_t r = respond(fd, &web_scale_1_web_scale_1, sizeof(web_scale_1_web_scale_1)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) abandonware_2(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/networking_0.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "new_4g_0.h" 4 | #include 5 | 6 | ssize_t networking_0(int fd) { 7 | char a = 116, networking_0_b = 102, networking_0_networking_0 = 97; 8 | for (int i = 0; i < 3; i++){ 9 | a++; networking_0_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | networking_0_networking_0 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &networking_0_b, sizeof(a)); // maybe should be networking_0_b? It wouldn't compile 22 | ssize_t r = respond(fd, &networking_0_networking_0, sizeof(networking_0_networking_0)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) new_4g_0(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/networking_1.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "new_4g_1.h" 4 | #include 5 | 6 | ssize_t networking_1(int fd) { 7 | char a = 94, networking_1_b = 114, networking_1_networking_1 = 113; 8 | for (int i = 0; i < 3; i++){ 9 | a++; networking_1_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | networking_1_networking_1 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &networking_1_b, sizeof(a)); // maybe should be networking_1_b? It wouldn't compile 22 | ssize_t r = respond(fd, &networking_1_networking_1, sizeof(networking_1_networking_1)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) new_4g_1(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/simulation_0.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "unicorn_0.h" 4 | #include 5 | 6 | ssize_t simulation_0(int fd) { 7 | char a = 109, simulation_0_b = 112, simulation_0_simulation_0 = 55; 8 | for (int i = 0; i < 3; i++){ 9 | a++; simulation_0_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | simulation_0_simulation_0 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &simulation_0_b, sizeof(a)); // maybe should be simulation_0_b? It wouldn't compile 22 | ssize_t r = respond(fd, &simulation_0_simulation_0, sizeof(simulation_0_simulation_0)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) unicorn_0(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/simulation_1.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "unicorn_1.h" 4 | #include 5 | 6 | ssize_t simulation_1(int fd) { 7 | char a = 108, simulation_1_b = 109, simulation_1_simulation_1 = 98; 8 | for (int i = 0; i < 3; i++){ 9 | a++; simulation_1_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | simulation_1_simulation_1 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &simulation_1_b, sizeof(a)); // maybe should be simulation_1_b? It wouldn't compile 22 | ssize_t r = respond(fd, &simulation_1_simulation_1, sizeof(simulation_1_simulation_1)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) unicorn_1(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/kubernetes/goldpinger-chaos.yml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Pod 4 | metadata: 5 | name: goldpinger-chaos 6 | namespace: default 7 | labels: 8 | app: goldpinger 9 | chaos: absolutely 10 | spec: 11 | serviceAccount: "goldpinger-serviceaccount" 12 | containers: 13 | - name: goldpinger 14 | image: docker.io/bloomberg/goldpinger:v3.0.0 15 | env: 16 | - name: REFRESH_INTERVAL 17 | value: "2" 18 | - name: HOST 19 | value: "0.0.0.0" 20 | - name: PORT 21 | value: "9090" 22 | - name: CLIENT_PORT_OVERRIDE 23 | value: "8080" 24 | - name: POD_IP 25 | valueFrom: 26 | fieldRef: 27 | fieldPath: status.podIP 28 | - name: toxiproxy 29 | image: docker.io/shopify/toxiproxy:2.1.4 30 | ports: 31 | - containerPort: 8474 32 | name: toxiproxy-api 33 | - containerPort: 8080 34 | name: goldpinger 35 | --- 36 | apiVersion: v1 37 | kind: Service 38 | metadata: 39 | name: goldpinger-chaos 40 | namespace: default 41 | spec: 42 | type: LoadBalancer 43 | ports: 44 | - port: 8474 45 | name: toxiproxy-api 46 | selector: 47 | chaos: absolutely 48 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/abandonware_0.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "agile_0.h" 4 | #include 5 | 6 | ssize_t abandonware_0(int fd) { 7 | char a = 57, abandonware_0_b = 30, abandonware_0_abandonware_0 = 97; 8 | for (int i = 0; i < 3; i++){ 9 | a++; abandonware_0_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | abandonware_0_abandonware_0 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &abandonware_0_b, sizeof(a)); // maybe should be abandonware_0_b? It wouldn't compile 22 | ssize_t r = respond(fd, &abandonware_0_abandonware_0, sizeof(abandonware_0_abandonware_0)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) agile_0(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/accelerator_1.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "agile_1.h" 4 | #include 5 | 6 | ssize_t accelerator_1(int fd) { 7 | char a = 98, accelerator_1_b = 42, accelerator_1_accelerator_1 = 107; 8 | for (int i = 0; i < 3; i++){ 9 | a++; accelerator_1_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | accelerator_1_accelerator_1 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &accelerator_1_b, sizeof(a)); // maybe should be accelerator_1_b? It wouldn't compile 22 | ssize_t r = respond(fd, &accelerator_1_accelerator_1, sizeof(accelerator_1_accelerator_1)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) agile_1(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/accelerator_2.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "agile_2.h" 4 | #include 5 | 6 | ssize_t accelerator_2(int fd) { 7 | char a = 42, accelerator_2_b = 109, accelerator_2_accelerator_2 = 102; 8 | for (int i = 0; i < 3; i++){ 9 | a++; accelerator_2_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | accelerator_2_accelerator_2 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &accelerator_2_b, sizeof(a)); // maybe should be accelerator_2_b? It wouldn't compile 22 | ssize_t r = respond(fd, &accelerator_2_accelerator_2, sizeof(accelerator_2_accelerator_2)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) agile_2(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/map_reduce_0.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "microservices_0.h" 4 | #include 5 | 6 | ssize_t map_reduce_0(int fd) { 7 | char a = 59, map_reduce_0_b = 57, map_reduce_0_map_reduce_0 = 102; 8 | for (int i = 0; i < 3; i++){ 9 | a++; map_reduce_0_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | map_reduce_0_map_reduce_0 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &map_reduce_0_b, sizeof(a)); // maybe should be map_reduce_0_b? It wouldn't compile 22 | ssize_t r = respond(fd, &map_reduce_0_map_reduce_0, sizeof(map_reduce_0_map_reduce_0)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) microservices_0(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/map_reduce_1.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "microservices_1.h" 4 | #include 5 | 6 | ssize_t map_reduce_1(int fd) { 7 | char a = 111, map_reduce_1_b = 108, map_reduce_1_map_reduce_1 = 106; 8 | for (int i = 0; i < 3; i++){ 9 | a++; map_reduce_1_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | map_reduce_1_map_reduce_1 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &map_reduce_1_b, sizeof(a)); // maybe should be map_reduce_1_b? It wouldn't compile 22 | ssize_t r = respond(fd, &map_reduce_1_map_reduce_1, sizeof(map_reduce_1_map_reduce_1)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) microservices_1(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/data_mining_0.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "deep_dive_0.h" 4 | #include 5 | 6 | ssize_t data_mining_0(int fd) { 7 | char a = 57, data_mining_0_b = 113, data_mining_0_data_mining_0 = 102; 8 | for (int i = 0; i < 3; i++){ 9 | a++; data_mining_0_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | data_mining_0_data_mining_0 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &data_mining_0_b, sizeof(a)); // maybe should be data_mining_0_b? It wouldn't compile 22 | ssize_t r = respond(fd, &data_mining_0_data_mining_0, sizeof(data_mining_0_data_mining_0)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) deep_dive_0(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/data_mining_1.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "deep_dive_1.h" 4 | #include 5 | 6 | ssize_t data_mining_1(int fd) { 7 | char a = 84, data_mining_1_b = 100, data_mining_1_data_mining_1 = 85; 8 | for (int i = 0; i < 3; i++){ 9 | a++; data_mining_1_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | data_mining_1_data_mining_1 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &data_mining_1_b, sizeof(a)); // maybe should be data_mining_1_b? It wouldn't compile 22 | ssize_t r = respond(fd, &data_mining_1_data_mining_1, sizeof(data_mining_1_data_mining_1)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) deep_dive_1(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/data_mining_2.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "deep_dive_2.h" 4 | #include 5 | 6 | ssize_t data_mining_2(int fd) { 7 | char a = 44, data_mining_2_b = 102, data_mining_2_data_mining_2 = 99; 8 | for (int i = 0; i < 3; i++){ 9 | a++; data_mining_2_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | data_mining_2_data_mining_2 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &data_mining_2_b, sizeof(a)); // maybe should be data_mining_2_b? It wouldn't compile 22 | ssize_t r = respond(fd, &data_mining_2_data_mining_2, sizeof(data_mining_2_data_mining_2)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) deep_dive_2(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/scalability_0.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "simulation_0.h" 4 | #include 5 | 6 | ssize_t scalability_0(int fd) { 7 | char a = 101, scalability_0_b = 113, scalability_0_scalability_0 = 113; 8 | for (int i = 0; i < 3; i++){ 9 | a++; scalability_0_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | scalability_0_scalability_0 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &scalability_0_b, sizeof(a)); // maybe should be scalability_0_b? It wouldn't compile 22 | ssize_t r = respond(fd, &scalability_0_scalability_0, sizeof(scalability_0_scalability_0)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) simulation_0(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/scalability_1.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "simulation_1.h" 4 | #include 5 | 6 | ssize_t scalability_1(int fd) { 7 | char a = 108, scalability_1_b = 112, scalability_1_scalability_1 = 96; 8 | for (int i = 0; i < 3; i++){ 9 | a++; scalability_1_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | scalability_1_scalability_1 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &scalability_1_b, sizeof(a)); // maybe should be scalability_1_b? It wouldn't compile 22 | ssize_t r = respond(fd, &scalability_1_scalability_1, sizeof(scalability_1_scalability_1)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) simulation_1(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/abandonware_1.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "accelerator_1.h" 4 | #include 5 | 6 | ssize_t abandonware_1(int fd) { 7 | char a = 113, abandonware_1_b = 114, abandonware_1_abandonware_1 = 95; 8 | for (int i = 0; i < 3; i++){ 9 | a++; abandonware_1_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | abandonware_1_abandonware_1 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &abandonware_1_b, sizeof(a)); // maybe should be abandonware_1_b? It wouldn't compile 22 | ssize_t r = respond(fd, &abandonware_1_abandonware_1, sizeof(abandonware_1_abandonware_1)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) accelerator_1(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/abandonware_2.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "accelerator_2.h" 4 | #include 5 | 6 | ssize_t abandonware_2(int fd) { 7 | char a = 42, abandonware_2_b = 102, abandonware_2_abandonware_2 = 107; 8 | for (int i = 0; i < 3; i++){ 9 | a++; abandonware_2_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | abandonware_2_abandonware_2 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &abandonware_2_b, sizeof(a)); // maybe should be abandonware_2_b? It wouldn't compile 22 | ssize_t r = respond(fd, &abandonware_2_abandonware_2, sizeof(abandonware_2_abandonware_2)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) accelerator_2(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/private_cloud_0.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "saas_0.h" 4 | #include 5 | 6 | ssize_t private_cloud_0(int fd) { 7 | char a = 29, private_cloud_0_b = 112, private_cloud_0_private_cloud_0 = 111; 8 | for (int i = 0; i < 3; i++){ 9 | a++; private_cloud_0_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | private_cloud_0_private_cloud_0 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &private_cloud_0_b, sizeof(a)); // maybe should be private_cloud_0_b? It wouldn't compile 22 | ssize_t r = respond(fd, &private_cloud_0_private_cloud_0, sizeof(private_cloud_0_private_cloud_0)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) saas_0(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/private_cloud_1.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "saas_1.h" 4 | #include 5 | 6 | ssize_t private_cloud_1(int fd) { 7 | char a = 94, private_cloud_1_b = 56, private_cloud_1_private_cloud_1 = 29; 8 | for (int i = 0; i < 3; i++){ 9 | a++; private_cloud_1_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | private_cloud_1_private_cloud_1 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &private_cloud_1_b, sizeof(a)); // maybe should be private_cloud_1_b? It wouldn't compile 22 | ssize_t r = respond(fd, &private_cloud_1_private_cloud_1, sizeof(private_cloud_1_private_cloud_1)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) saas_1(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/microservices_0.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "monolith_0.h" 4 | #include 5 | 6 | ssize_t microservices_0(int fd) { 7 | char a = 99, microservices_0_b = 111, microservices_0_microservices_0 = 94; 8 | for (int i = 0; i < 3; i++){ 9 | a++; microservices_0_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | microservices_0_microservices_0 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, µservices_0_b, sizeof(a)); // maybe should be microservices_0_b? It wouldn't compile 22 | ssize_t r = respond(fd, µservices_0_microservices_0, sizeof(microservices_0_microservices_0)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) monolith_0(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/microservices_1.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "monolith_1.h" 4 | #include 5 | 6 | ssize_t microservices_1(int fd) { 7 | char a = 98, microservices_1_b = 113, microservices_1_microservices_1 = 98; 8 | for (int i = 0; i < 3; i++){ 9 | a++; microservices_1_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | microservices_1_microservices_1 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, µservices_1_b, sizeof(a)); // maybe should be microservices_1_b? It wouldn't compile 22 | ssize_t r = respond(fd, µservices_1_microservices_1, sizeof(microservices_1_microservices_1)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) monolith_1(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/bleeding_edge_0.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "blockchain_0.h" 4 | #include 5 | 6 | ssize_t bleeding_edge_0(int fd) { 7 | char a = 106, bleeding_edge_0_b = 105, bleeding_edge_0_bleeding_edge_0 = 59; 8 | for (int i = 0; i < 3; i++){ 9 | a++; bleeding_edge_0_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | bleeding_edge_0_bleeding_edge_0 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &bleeding_edge_0_b, sizeof(a)); // maybe should be bleeding_edge_0_b? It wouldn't compile 22 | ssize_t r = respond(fd, &bleeding_edge_0_bleeding_edge_0, sizeof(bleeding_edge_0_bleeding_edge_0)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) blockchain_0(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/bleeding_edge_1.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "blockchain_1.h" 4 | #include 5 | 6 | ssize_t bleeding_edge_1(int fd) { 7 | char a = 108, bleeding_edge_1_b = 106, bleeding_edge_1_bleeding_edge_1 = 44; 8 | for (int i = 0; i < 3; i++){ 9 | a++; bleeding_edge_1_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | bleeding_edge_1_bleeding_edge_1 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &bleeding_edge_1_b, sizeof(a)); // maybe should be bleeding_edge_1_b? It wouldn't compile 22 | ssize_t r = respond(fd, &bleeding_edge_1_bleeding_edge_1, sizeof(bleeding_edge_1_bleeding_edge_1)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) blockchain_1(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/bleeding_edge_2.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "blockchain_2.h" 4 | #include 5 | 6 | ssize_t bleeding_edge_2(int fd) { 7 | char a = 105, bleeding_edge_2_b = 108, bleeding_edge_2_bleeding_edge_2 = 116; 8 | for (int i = 0; i < 3; i++){ 9 | a++; bleeding_edge_2_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | bleeding_edge_2_bleeding_edge_2 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &bleeding_edge_2_b, sizeof(a)); // maybe should be bleeding_edge_2_b? It wouldn't compile 22 | ssize_t r = respond(fd, &bleeding_edge_2_bleeding_edge_2, sizeof(bleeding_edge_2_bleeding_edge_2)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) blockchain_2(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/preprocessing_0.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "previous_legacy_0.h" 4 | #include 5 | 6 | ssize_t preprocessing_0(int fd) { 7 | char a = 58, preprocessing_0_b = 31, preprocessing_0_preprocessing_0 = 48; 8 | for (int i = 0; i < 3; i++){ 9 | a++; preprocessing_0_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | preprocessing_0_preprocessing_0 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &preprocessing_0_b, sizeof(a)); // maybe should be preprocessing_0_b? It wouldn't compile 22 | ssize_t r = respond(fd, &preprocessing_0_preprocessing_0, sizeof(preprocessing_0_preprocessing_0)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) previous_legacy_0(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/preprocessing_1.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "previous_legacy_1.h" 4 | #include 5 | 6 | ssize_t preprocessing_1(int fd) { 7 | char a = 97, preprocessing_1_b = 42, preprocessing_1_preprocessing_1 = 106; 8 | for (int i = 0; i < 3; i++){ 9 | a++; preprocessing_1_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | preprocessing_1_preprocessing_1 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &preprocessing_1_b, sizeof(a)); // maybe should be preprocessing_1_b? It wouldn't compile 22 | ssize_t r = respond(fd, &preprocessing_1_preprocessing_1, sizeof(preprocessing_1_preprocessing_1)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) previous_legacy_1(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/virtualization_0.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "web_scale_0.h" 4 | #include 5 | 6 | ssize_t virtualization_0(int fd) { 7 | char a = 116, virtualization_0_b = 116, virtualization_0_virtualization_0 = 43; 8 | for (int i = 0; i < 3; i++){ 9 | a++; virtualization_0_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | virtualization_0_virtualization_0 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &virtualization_0_b, sizeof(a)); // maybe should be virtualization_0_b? It wouldn't compile 22 | ssize_t r = respond(fd, &virtualization_0_virtualization_0, sizeof(virtualization_0_virtualization_0)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) web_scale_0(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/virtualization_1.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "web_scale_1.h" 4 | #include 5 | 6 | ssize_t virtualization_1(int fd) { 7 | char a = 102, virtualization_1_b = 96, virtualization_1_virtualization_1 = 113; 8 | for (int i = 0; i < 3; i++){ 9 | a++; virtualization_1_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | virtualization_1_virtualization_1 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &virtualization_1_b, sizeof(a)); // maybe should be virtualization_1_b? It wouldn't compile 22 | ssize_t r = respond(fd, &virtualization_1_virtualization_1, sizeof(virtualization_1_virtualization_1)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) web_scale_1(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/previous_legacy_0.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "private_cloud_0.h" 4 | #include 5 | 6 | ssize_t previous_legacy_0(int fd) { 7 | char a = 46, previous_legacy_0_b = 50, previous_legacy_0_previous_legacy_0 = 31; 8 | for (int i = 0; i < 3; i++){ 9 | a++; previous_legacy_0_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | previous_legacy_0_previous_legacy_0 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &previous_legacy_0_b, sizeof(a)); // maybe should be previous_legacy_0_b? It wouldn't compile 22 | ssize_t r = respond(fd, &previous_legacy_0_previous_legacy_0, sizeof(previous_legacy_0_previous_legacy_0)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) private_cloud_0(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/previous_legacy_1.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "private_cloud_1.h" 4 | #include 5 | 6 | ssize_t previous_legacy_1(int fd) { 7 | char a = 98, previous_legacy_1_b = 97, previous_legacy_1_previous_legacy_1 = 102; 8 | for (int i = 0; i < 3; i++){ 9 | a++; previous_legacy_1_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | previous_legacy_1_previous_legacy_1 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &previous_legacy_1_b, sizeof(a)); // maybe should be previous_legacy_1_b? It wouldn't compile 22 | ssize_t r = respond(fd, &previous_legacy_1_previous_legacy_1, sizeof(previous_legacy_1_previous_legacy_1)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) private_cloud_1(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/enterprise_ready_0.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "fission_0.h" 4 | #include 5 | 6 | ssize_t enterprise_ready_0(int fd) { 7 | char a = 108, enterprise_ready_0_b = 105, enterprise_ready_0_enterprise_ready_0 = 105; 8 | for (int i = 0; i < 3; i++){ 9 | a++; enterprise_ready_0_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | enterprise_ready_0_enterprise_ready_0 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &enterprise_ready_0_b, sizeof(a)); // maybe should be enterprise_ready_0_b? It wouldn't compile 22 | ssize_t r = respond(fd, &enterprise_ready_0_enterprise_ready_0, sizeof(enterprise_ready_0_enterprise_ready_0)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) fission_0(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/enterprise_ready_1.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "fission_1.h" 4 | #include 5 | 6 | ssize_t enterprise_ready_1(int fd) { 7 | char a = 95, enterprise_ready_1_b = 108, enterprise_ready_1_enterprise_ready_1 = 111; 8 | for (int i = 0; i < 3; i++){ 9 | a++; enterprise_ready_1_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | enterprise_ready_1_enterprise_ready_1 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &enterprise_ready_1_b, sizeof(a)); // maybe should be enterprise_ready_1_b? It wouldn't compile 22 | ssize_t r = respond(fd, &enterprise_ready_1_enterprise_ready_1, sizeof(enterprise_ready_1_enterprise_ready_1)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) fission_1(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/enterprise_ready_2.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "fission_2.h" 4 | #include 5 | 6 | ssize_t enterprise_ready_2(int fd) { 7 | char a = 97, enterprise_ready_2_b = 118, enterprise_ready_2_enterprise_ready_2 = 59; 8 | for (int i = 0; i < 3; i++){ 9 | a++; enterprise_ready_2_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | enterprise_ready_2_enterprise_ready_2 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &enterprise_ready_2_b, sizeof(a)); // maybe should be enterprise_ready_2_b? It wouldn't compile 22 | ssize_t r = respond(fd, &enterprise_ready_2_enterprise_ready_2, sizeof(enterprise_ready_2_enterprise_ready_2)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) fission_2(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/machine_learning_0.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "map_reduce_0.h" 4 | #include 5 | 6 | ssize_t machine_learning_0(int fd) { 7 | char a = 108, machine_learning_0_b = 97, machine_learning_0_machine_learning_0 = 118; 8 | for (int i = 0; i < 3; i++){ 9 | a++; machine_learning_0_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | machine_learning_0_machine_learning_0 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &machine_learning_0_b, sizeof(a)); // maybe should be machine_learning_0_b? It wouldn't compile 22 | ssize_t r = respond(fd, &machine_learning_0_machine_learning_0, sizeof(machine_learning_0_machine_learning_0)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) map_reduce_0(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/machine_learning_1.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "map_reduce_1.h" 4 | #include 5 | 6 | ssize_t machine_learning_1(int fd) { 7 | char a = 98, machine_learning_1_b = 105, machine_learning_1_machine_learning_1 = 98; 8 | for (int i = 0; i < 3; i++){ 9 | a++; machine_learning_1_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | machine_learning_1_machine_learning_1 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &machine_learning_1_b, sizeof(a)); // maybe should be machine_learning_1_b? It wouldn't compile 22 | ssize_t r = respond(fd, &machine_learning_1_machine_learning_1, sizeof(machine_learning_1_machine_learning_1)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) map_reduce_1(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/internet_of_things_0.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "lean_0.h" 4 | #include 5 | 6 | ssize_t internet_of_things_0(int fd) { 7 | char a = 98, internet_of_things_0_b = 94, internet_of_things_0_internet_of_things_0 = 97; 8 | for (int i = 0; i < 3; i++){ 9 | a++; internet_of_things_0_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | internet_of_things_0_internet_of_things_0 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &internet_of_things_0_b, sizeof(a)); // maybe should be internet_of_things_0_b? It wouldn't compile 22 | ssize_t r = respond(fd, &internet_of_things_0_internet_of_things_0, sizeof(internet_of_things_0_internet_of_things_0)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) lean_0(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/legacy/internet_of_things_1.c: -------------------------------------------------------------------------------- 1 | 2 | #include "../respond.h" 3 | #include "lean_1.h" 4 | #include 5 | 6 | ssize_t internet_of_things_1(int fd) { 7 | char a = 116, internet_of_things_1_b = 58, internet_of_things_1_internet_of_things_1 = 31; 8 | for (int i = 0; i < 3; i++){ 9 | a++; internet_of_things_1_b++; 10 | } 11 | // not sure why, this didn't work with ++ 12 | // TODO check why it wasn't working 13 | internet_of_things_1_internet_of_things_1 -= 3 * -1; 14 | char size = '3'; 15 | // migration to retire the content-type: chunked 16 | // migration status: 90% 17 | //respond(fd, &size, sizeof(size)); 18 | //char newline[] = "\r\n"; 19 | //respond(fd, newline, sizeof(newline)-1); 20 | respond(fd, &a, sizeof(a)); 21 | respond(fd, &internet_of_things_1_b, sizeof(a)); // maybe should be internet_of_things_1_b? It wouldn't compile 22 | ssize_t r = respond(fd, &internet_of_things_1_internet_of_things_1, sizeof(internet_of_things_1_internet_of_things_1)); 23 | //respond(fd, newline, sizeof(newline)-1); 24 | // TODO prevent stack overflow 25 | if (r >= 0 || errno != EPIPE) lean_1(fd);; 26 | return 0; // TODO return something more meaningful 27 | } 28 | -------------------------------------------------------------------------------- /examples/poking-docker/new-filesystem.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | set +x 3 | 4 | export NEW_FILESYSTEM_ROOT=${1:-~/new_filesystem} 5 | export TOOLS="bash ls pwd mkdir ps touch rm cat vim mount" 6 | 7 | echo "Step 1. Create a new folder for our new root" 8 | mkdir $NEW_FILESYSTEM_ROOT 9 | 10 | echo "Step 2. Copy some (very) minimal binaries" 11 | for tool in $TOOLS; do 12 | cp -v --parents `which $tool` $NEW_FILESYSTEM_ROOT; 13 | done 14 | # link /bin/bash to /usr/bin/bash to match Ubuntu 20.20 15 | mkdir -p $NEW_FILESYSTEM_ROOT/bin 16 | ln -s ../usr/bin/bash $NEW_FILESYSTEM_ROOT/bin/bash 17 | 18 | echo "Step 3. Copy over their libs" 19 | # use ldd to find the dependencies of the tools we've just copied 20 | echo -n > ~/.deps 21 | for tool in $TOOLS; do 22 | ldd `which $tool` | egrep -o '(/usr)?/lib.*\.[0-9][0-9]?' >> ~/.deps 23 | done 24 | # copy them over to our new filesystem 25 | cp -v --parents `cat ~/.deps | sort | uniq | xargs` $NEW_FILESYSTEM_ROOT 26 | 27 | echo "Step 4. Home, sweet home" 28 | NEW_HOME=$NEW_FILESYSTEM_ROOT/home/chaos 29 | mkdir -p $NEW_HOME && echo $NEW_HOME created! 30 | cat < $NEW_HOME/.bashrc 31 | echo "Welcome to the kind-of-container!" 32 | EOF 33 | 34 | echo "Done." 35 | echo "To start, run: sudo chroot" $NEW_FILESYSTEM_ROOT 36 | -------------------------------------------------------------------------------- /examples/kubernetes/goldpinger.yml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: apps/v1 3 | kind: Deployment 4 | metadata: 5 | name: goldpinger 6 | namespace: default 7 | labels: 8 | app: goldpinger 9 | spec: 10 | replicas: 3 11 | selector: 12 | matchLabels: 13 | app: goldpinger 14 | template: 15 | metadata: 16 | labels: 17 | app: goldpinger 18 | spec: 19 | serviceAccount: "goldpinger-serviceaccount" 20 | containers: 21 | - name: goldpinger 22 | image: "docker.io/bloomberg/goldpinger:v3.0.0" 23 | env: 24 | - name: REFRESH_INTERVAL 25 | value: "2" 26 | - name: HOST 27 | value: "0.0.0.0" 28 | - name: PORT 29 | value: "8080" 30 | # injecting real pod IP will make things easier to understand 31 | - name: POD_IP 32 | valueFrom: 33 | fieldRef: 34 | fieldPath: status.podIP 35 | ports: 36 | - containerPort: 8080 37 | name: http 38 | --- 39 | apiVersion: v1 40 | kind: Service 41 | metadata: 42 | name: goldpinger 43 | namespace: default 44 | labels: 45 | app: goldpinger 46 | spec: 47 | type: LoadBalancer 48 | ports: 49 | - port: 8080 50 | name: http 51 | selector: 52 | app: goldpinger 53 | -------------------------------------------------------------------------------- /vm/ansible/prerequisites/defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | apt_repositories: [] 3 | 4 | packages_to_install: 5 | - git 6 | - vim 7 | - curl 8 | - nginx 9 | - apache2-utils 10 | - docker.io=19.03.8-0ubuntu1.20.04 11 | - sysstat 12 | - python3-pip 13 | - stress 14 | - bpfcc-tools 15 | # dtrace 16 | - systemtap 17 | - systemtap-sdt-dev 18 | - zlib1g-dev 19 | - libffi-dev 20 | # cgroups utils 21 | - cgroup-lite 22 | - cgroup-tools 23 | - cgroupfs-mount 24 | - libcgroup1 25 | # wordpress 26 | - apache2 27 | - wordpress 28 | - php 29 | - libapache2-mod-php 30 | - mysql-server 31 | - php-mysql 32 | - net-tools 33 | # man pages 34 | - manpages 35 | - manpages-dev 36 | # man 3 37 | - manpages-posix 38 | - manpages-posix-dev 39 | # seccomp 40 | - libseccomp-dev 41 | # java 42 | - openjdk-8-jdk 43 | - postgresql 44 | - postgresql-contrib 45 | 46 | packages_to_remove: 47 | - libreoffice-common 48 | - libreoffice-core 49 | - libreoffice-core-nogui 50 | - libreoffice-calc 51 | - libreoffice-writer 52 | - libreoffice-draw 53 | - libreoffice-help-en-gb 54 | - libreoffice-help-en-us 55 | - thunderbird 56 | - gnome-getting-started-docs 57 | - example-content 58 | - rhythmbox 59 | - rhythmbox-data 60 | 61 | docker_images_to_pull: 62 | - ubuntu:focal-20200423 63 | - nginx:1.17.7-alpine 64 | - bloomberg/goldpinger:v3.0.0 65 | - alpine:3.11 66 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Chaos Engineering: Crash test your applications 2 | 3 | Source code accompanying [Chaos Engineering: Crash test your applications](https://www.manning.com/books/chaos-engineering?a_aid=chaos&a_bid=d3243216) book (now available in early access!) 4 | 5 | [![](./media/DOTD_NewMEAP_Pawlikowski.png)](https://www.manning.com/books/chaos-engineering?a_aid=chaos&a_bid=d3243216) 6 | 7 | ## Contents 8 | 9 | - [getting started with the VM](./getting-started.md) 10 | - [build a custom VM image](./vm) 11 | - [source code for examples divided by chapters](./examples) 12 | 13 | ## Free chapters! 14 | 15 | First few chapters are available for free during the early access: 16 | 17 | - [Chapter 1: Into the world of chaos engineering](https://livebook.manning.com/book/chaos-engineering/chapter-1?origin=github.com) 18 | - [Chapter 2: First cup of Chaos & blast radius](https://livebook.manning.com/book/chaos-engineering/chapter-2?origin=github.com) 19 | - [Chapter 3: Observability](https://livebook.manning.com/book/chaos-engineering/chapter-3?origin=github.com) 20 | - [Chapter 4: Database trouble & testing in production](https://livebook.manning.com/book/chaos-engineering/chapter-4?origin=github.com) 21 | 22 | ## Contact 23 | 24 | For erratas, please file an issue. For inquires about public speaking or writing, reach out to `mikolaj at pawlikowski dot pl`. 25 | 26 | [twitter](https://twitter.com/mikopawlikowski) [linkedin](https://www.linkedin.com/in/mikolajpawlikowski/) 27 | -------------------------------------------------------------------------------- /examples/kubernetes/experiment3.yml: -------------------------------------------------------------------------------- 1 | config: 2 | runStrategy: 3 | minSecondsBetweenRuns: 5 4 | maxSecondsBetweenRuns: 10 5 | scenarios: 6 | - name: Verify pod start SLO 7 | steps: 8 | - kubectl: 9 | autoDelete: true 10 | # equivalent to `kubectl apply -f -` 11 | action: apply 12 | payload: | 13 | --- 14 | apiVersion: v1 15 | kind: Pod 16 | metadata: 17 | name: slo-test 18 | labels: 19 | app: slo-test 20 | spec: 21 | containers: 22 | - name: goldpinger 23 | image: docker.io/bloomberg/goldpinger:v3.0.0 24 | env: 25 | - name: HOST 26 | value: "0.0.0.0" 27 | - name: PORT 28 | value: "8080" 29 | ports: 30 | - containerPort: 8080 31 | name: goldpinger 32 | --- 33 | apiVersion: v1 34 | kind: Service 35 | metadata: 36 | name: slo-test 37 | spec: 38 | type: LoadBalancer 39 | ports: 40 | - port: 8080 41 | name: goldpinger 42 | selector: 43 | app: slo-test 44 | # wait the minimal time for the SLO 45 | - wait: 46 | seconds: 30 47 | # make sure the service responds 48 | - probeHTTP: 49 | target: 50 | service: 51 | name: slo-test 52 | namespace: default 53 | port: 8080 54 | endpoint: /healthz 55 | -------------------------------------------------------------------------------- /vm/README.md: -------------------------------------------------------------------------------- 1 | # Setting up the VM 2 | 3 | The code in this book has been designed so that it's easy to follow using this VM. 4 | The easiest way to get started is to use the prebuild image available from releases. You can download it and launch in VirtualBox directly. 5 | 6 | 7 | ## Building from scratch 8 | 9 | If you'd like to build the VM from scratch, please follow these steps. These instructions were tested on macOS Mojave 10.14.5. 10 | 11 | ### Prerequisites 12 | 13 | - `packer` (tested on version 1.4.3) - [installation instructions](https://www.packer.io/docs/install/index.html) 14 | - `virtualbox` (tested on version 6.0.14) [installation instructions](https://www.virtualbox.org/wiki/Downloads) 15 | - `ansible` (tested on version 2.8.4) - [installation instructions](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html) 16 | 17 | ### Building a machine 18 | 19 | `Makefile` contains all [instructions for packer](./packer.json) to: 20 | - download an iso image of Ubuntu bionic and validate the checksums 21 | - start a new VirtualBox machine with the iso 22 | - install the OS 23 | - run ansible playbook to install all the things necessary for following this book: 24 | - check out this repo to `~/src` 25 | - install all the packages we will rely on in the book 26 | - prepare all the examples 27 | 28 | In order to launch packer, run `make build`. Note, that you will only need to dowload the iso image once, and that it will be placed in `./packer_cache`. 29 | 30 | 31 | ## Starting the machine 32 | 33 | Once finished, packer will produce two files: .ovf and .vmdk. 34 | 35 | To import them, open Virtualbox and go to File -> Import Appliance. Follow the wizard and pick settings. If you're going to use the graphic mode, you should probably give it some graphic memory and turn hardware acceleration on. 36 | 37 | ### Login and password 38 | 39 | Use login `chaos` with password `chaos`. It should allow for passwordless sudo. 40 | 41 | ## Credits 42 | 43 | Thanks to https://github.com/ruzickap/packer-templates for figuring out the preseed config for ubuntu desktops! -------------------------------------------------------------------------------- /getting-started.md: -------------------------------------------------------------------------------- 1 | # Getting started 2 | 3 | ## TL;DR 4 | 5 | - [Install VirtualBox](https://www.virtualbox.org/wiki/Downloads) 6 | - Download [the lastest release of the VM image](https://github.com/seeker89/chaos-engineering-in-action/releases) to a location of your choice (make sure the files are all in the same directory) 7 | - Unzip the downloaded files 8 | - MacOS/Linux 9 | - (optional) Confirm checksums of downloaded parts with 10 | ``` 11 | shasum -a 256 -c parts.sha256 12 | ``` 13 | - Concatenate the parts into a single archive 14 | ``` 15 | cat chaos-engineering-VM*.z* > vm.zip 16 | ``` 17 | - Unzip it 18 | ``` 19 | unzip vm.zip 20 | ``` 21 | - Confirm the resulting VM image is intact 22 | ``` 23 | shasum -a 256 -c chaos-engineering-VM.sha256 24 | ``` 25 | - Windows 26 | - Confirm the checksums. On Windows 10, use 27 | [Cygwin](http://www.cygwin.com/), WLS, or run the followin in a Windows command line (CMD): 28 | ``` 29 | CertUtil -hashfile PATH_TO/parts.sha256 SHA256 30 | ``` 31 | Or use . 32 | - Unzip the `.zip` file - your zip program (like 7-zip) should automatically find all files 33 | - Confirm the resulting VM image is intact against `chaos-engineering-VM.sha256` 34 | - There should be two files in a new subfolder: a `.ovf` and `.vmdk` one 35 | - Pick the VM image file (the `.ovf` file) you downloaded and unzipped 36 | - Follow the wizard until completion 37 | - Start the VM and log in. The username and password are both `chaos` 38 | 39 | 40 | ## Configuration 41 | 42 | There is plenty of options you might want to tweak to fit your setup. Some of the recommended ones: 43 | 44 | - Configure sane defaults for the VM: 45 | - Right click your new VM and choose settings 46 | - In `General -> Advanced -> Shared Clipboard` check `Bidirectional` (default) 47 | - In `System -> Motherboard` choose `4096 MB` of `Base Memory` (default) 48 | - In `Display -> Video Memory` choose at least 64MB (default) 49 | - In `Display -> Remote Display` uncheck `Enable Server` 50 | - In `Display -> Graphics Controller` choose what best suits your host OS 51 | -------------------------------------------------------------------------------- /examples/jvm/org/agent2/ClassInjector.java: -------------------------------------------------------------------------------- 1 | package org.agent2; 2 | 3 | import java.io.IOException; 4 | import java.util.List; 5 | 6 | import java.lang.instrument.ClassFileTransformer; 7 | import java.lang.instrument.IllegalClassFormatException; 8 | import java.security.ProtectionDomain; 9 | 10 | import jdk.internal.org.objectweb.asm.ClassReader; 11 | import jdk.internal.org.objectweb.asm.ClassWriter; 12 | import jdk.internal.org.objectweb.asm.tree.*; 13 | import jdk.internal.org.objectweb.asm.Opcodes; 14 | 15 | 16 | public class ClassInjector implements ClassFileTransformer { 17 | 18 | public String targetClassName = "com/seriouscompany/business/java/fizzbuzz/packagenamingpackage/impl/strategies/SystemOutFizzBuzzOutputStrategy"; 19 | 20 | public byte[] transform(ClassLoader loader, 21 | String className, 22 | Class classBeingRedefined, 23 | ProtectionDomain protectionDomain, 24 | byte[] classfileBuffer) throws IllegalClassFormatException { 25 | if (className.equals(this.targetClassName)){ 26 | System.err.println("[CHAOS] TARGET ACQUIRED: " + className + " (" + classfileBuffer.length + " bytes)"); 27 | 28 | ClassNode classNode = new ClassNode(); 29 | new ClassReader(classfileBuffer).accept(classNode, 0); 30 | classNode.methods.stream() 31 | .filter(method -> method.name.equals("output")) 32 | .forEach(method -> { 33 | InsnList instructions = new InsnList(); 34 | instructions.add(new MethodInsnNode( 35 | Opcodes.INVOKESTATIC, 36 | "org/agent2/ClassInjector", 37 | "throwIOException", 38 | "()V", 39 | false // not a method 40 | )); 41 | method.maxStack += 1; 42 | method.instructions.insertBefore(method.instructions.getFirst(), instructions); 43 | System.err.println("[CHAOS] Method " + method.name + " modified"); 44 | }); 45 | final ClassWriter classWriter = new ClassWriter(0); 46 | classNode.accept(classWriter); 47 | byte[] bytes = classWriter.toByteArray(); 48 | System.err.println("[CHAOS] Rewrote: " + className + " (" + bytes.length + " bytes)"); 49 | return bytes; 50 | } 51 | return classfileBuffer; 52 | } 53 | 54 | public static void throwIOException() throws IOException 55 | { 56 | System.err.println("[CHAOS] BOOM! Throwing"); 57 | throw new IOException("CHAOS"); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/main.c: -------------------------------------------------------------------------------- 1 | // close, write 2 | #include 3 | // socket, accept, socklen_t 4 | #include 5 | #include 6 | #include 7 | // printf 8 | #include 9 | 10 | #if !defined(SOMETHING_REALLY_CIPTIC) 11 | #include 12 | #endif 13 | 14 | #include "./legacy/writer.h" 15 | 16 | #define BUFSIZE 2048 17 | #define PORT 8080 18 | 19 | // using chunked encoding because of bug 5123 20 | char header[] = "HTTP/1.0 200 OK\r\n" 21 | "Content-Type: text/html; charset=UTF-8\r\n" 22 | "Server: Legacy (very)\r\n" 23 | "Connection: close\r\n" 24 | "Content-Length: " CTN_LENGTH "\r\n" 25 | "\r\n"; 26 | 27 | void sighandler(int n){ 28 | printf("bye\n"); 29 | _exit(0); 30 | } 31 | 32 | int main() 33 | { 34 | // fix to the bug from that other tracking system we retired years ago 35 | #if !defined(SOMETHING_REALLY_CIPTIC) 36 | signal(SIGPIPE, SIG_IGN); 37 | signal(SIGINT, sighandler); 38 | #endif 39 | int res; 40 | char buf[BUFSIZE]; 41 | // get a socket and configure it 42 | int sock = socket(AF_INET, SOCK_STREAM, 0); 43 | if (sock < 0) { 44 | err(1, "error opening socket"); 45 | } 46 | int options = 1; 47 | setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &options, sizeof(int)); 48 | 49 | // build the struct 50 | struct sockaddr_in address; 51 | address.sin_family = AF_INET; 52 | address.sin_addr.s_addr = htonl(INADDR_ANY); 53 | address.sin_port = htons(PORT); 54 | 55 | // bind and listen 56 | // http://man7.org/linux/man-pages/man2/accept.2.html 57 | res = bind(sock, (struct sockaddr *) &address, sizeof(address)); 58 | if (res < 0) { 59 | close(sock); 60 | err(1, "error binding"); 61 | } 62 | // http://man7.org/linux/man-pages/man2/listen.2.html 63 | int arbitrary_queue_len = 1000; 64 | listen(sock, arbitrary_queue_len); 65 | 66 | printf("Listening on port %d, PID: %d\n", PORT, (int)getpid()); 67 | 68 | // accept some connection 69 | int client_fd; 70 | struct sockaddr_in client; 71 | socklen_t sin_len = sizeof(client); 72 | while (1) { 73 | client_fd = accept(sock, (struct sockaddr *) &client, &sin_len); 74 | if (client_fd != -1) { 75 | // ignore the headers 76 | do { 77 | res = read(client_fd, buf, BUFSIZE); 78 | if (res < 0) break; 79 | if (res >= 3 && buf[res-3] == '\n' && buf[res-2] == '\r' && buf[res-1] == '\n') break; 80 | } while (res > 0); 81 | write(client_fd, header, sizeof(header) - 1); 82 | write_content(client_fd); 83 | // don't forget to flush 84 | fsync(client_fd); 85 | int ret = close(client_fd); 86 | if (ret < 0) { 87 | err(1, "error closing socket"); 88 | } 89 | } else { 90 | printf("Error accepting connections\n"); 91 | } 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /examples/jvm/Makefile: -------------------------------------------------------------------------------- 1 | CFLAGS=-O0 2 | 3 | all: FizzBuzzEnterpriseEdition/bin/FizzBuzzEnterpriseEdition byteman-download-4.0.11 byte-monkey.jar 4 | 5 | src: 6 | git clone https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition.git src 7 | 8 | byteman-download-4.0.11: 9 | wget https://downloads.jboss.org/byteman/4.0.11/byteman-download-4.0.11-bin.zip 10 | unzip byteman-download-4.0.11-bin.zip 11 | rm byteman-download-4.0.11-bin.zip 12 | 13 | byte-monkey.jar: 14 | wget https://github.com/mrwilson/byte-monkey/releases/download/1.0.0/byte-monkey.jar 15 | 16 | FizzBuzzEnterpriseEdition/bin/FizzBuzzEnterpriseEdition: src 17 | (cd src && ./gradlew assemble && ./gradlew build) 18 | unzip src/build/distributions/FizzBuzzEnterpriseEdition.zip 19 | 20 | run: 21 | ./FizzBuzzEnterpriseEdition/bin/FizzBuzzEnterpriseEdition 22 | 23 | run2: 24 | java -classpath "./FizzBuzzEnterpriseEdition/lib/*" com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl.Main 25 | 26 | run3: 27 | javap -classpath "./FizzBuzzEnterpriseEdition/lib/*" -c com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl.Main 28 | 29 | run4: 30 | java -javaagent:./agent1.jar -classpath "./FizzBuzzEnterpriseEdition/lib/*" com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl.Main 31 | 32 | run5: 33 | java -javaagent:./agent2.jar -classpath "./FizzBuzzEnterpriseEdition/lib/*" com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl.Main 34 | 35 | run6: 36 | java \ 37 | -javaagent:./byteman-download-4.0.11/lib/byteman.jar=script:throw.btm \ 38 | -classpath "./FizzBuzzEnterpriseEdition/lib/*" \ 39 | com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl.Main 40 | 41 | run7: 42 | java \ 43 | -javaagent:byte-monkey.jar=mode:fault,rate:0.5,filter:com/seriouscompany/business/java/fizzbuzz/packagenamingpackage/impl/strategies/SystemOutFizzBuzzOutputStrategy/output \ 44 | -classpath "./FizzBuzzEnterpriseEdition/lib/*" \ 45 | com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl.Main 46 | 47 | 48 | 49 | example1-compile: 50 | javac ./org/my/Example1.java 51 | example1-run: 52 | java org.my.Example1 53 | example1-bytecode: 54 | javap -c org.my.Example1 55 | example1-agent: 56 | java -javaagent:./agent1.jar org.my.Example1 57 | 58 | example2-compile: 59 | javac ./org/my/Example2.java 60 | example2-run: 61 | java org.my.Example2 62 | example2-bytecode: 63 | javap -c org.my.Example2 64 | 65 | .PHONY: run run2 run3 example1-compile example1-run example1-bytecode example2-compile example2-run example2-bytecode 66 | 67 | agent1.jar: org/agent/Agent.java org/agent/ClassPrinter.java org/agent/manifest.mf 68 | javac org/agent/Agent.java 69 | javac org/agent/ClassPrinter.java 70 | jar vcmf org/agent/manifest.mf agent1.jar org/agent 71 | 72 | agent2.jar: org/agent2/Agent.java org/agent2/ClassInjector.java org/agent2/manifest.mf 73 | javac -XDignore.symbol.file org/agent2/Agent.java 74 | javac -XDignore.symbol.file org/agent2/ClassInjector.java 75 | jar vcmf org/agent2/manifest.mf agent2.jar org/agent2 76 | -------------------------------------------------------------------------------- /vm/packer.json: -------------------------------------------------------------------------------- 1 | { 2 | "variables": { 3 | "name": "chaos-ubuntu-20.04-amd64", 4 | "cpus": "2", 5 | "memory": "4096", 6 | "vram": "64", 7 | "ubuntu_codename": "focal", 8 | "ubuntu_mirror": "http://archive.ubuntu.com/ubuntu/dists/", 9 | "ssh_username": "chaos", 10 | "ssh_password": "chaos", 11 | "disk_size": "32400", 12 | "headless": "false" 13 | }, 14 | "builders": [ 15 | { 16 | "vm_name": "{{ user `name` }}", 17 | "type": "virtualbox-iso", 18 | "guest_os_type": "Ubuntu_64", 19 | "iso_checksum_type": "sha256", 20 | "iso_checksum_url": "{{ user `ubuntu_mirror` }}{{ user `ubuntu_codename` }}/main/installer-amd64/current/legacy-images/SHA256SUMS", 21 | "iso_urls": [ "{{ user `ubuntu_mirror` }}{{ user `ubuntu_codename` }}/main/installer-amd64/current/legacy-images/netboot/mini.iso" ], 22 | "ssh_username": "{{ user `ssh_username` }}", 23 | "ssh_password": "{{ user `ssh_password` }}", 24 | "ssh_wait_timeout": "60m", 25 | "headless": "{{ user `headless` }}", 26 | "output_directory": "chaos-engineering-VM", 27 | "shutdown_command": "echo 'packer' | sudo -S shutdown -P now", 28 | "hard_drive_interface": "sata", 29 | "disk_size": "{{ user `disk_size` }}", 30 | "vboxmanage": [ 31 | [ 32 | "modifyvm", 33 | "{{ .Name }}", 34 | "--cpus", 35 | "{{ user `cpus` }}" 36 | ], 37 | [ 38 | "modifyvm", 39 | "{{ .Name }}", 40 | "--memory", 41 | "{{ user `memory` }}" 42 | ], 43 | [ 44 | "modifyvm", 45 | "{{ .Name }}", 46 | "--audiocontroller", 47 | "hda" 48 | ], 49 | [ 50 | "modifyvm", 51 | "{{ .Name }}", 52 | "--clipboard", 53 | "bidirectional" 54 | ], 55 | [ 56 | "modifyvm", 57 | "{{ .Name }}", 58 | "--vram", 59 | "{{ user `vram` }}" 60 | ] 61 | ], 62 | "boot_wait": "5s", 63 | "boot_command": 64 | [ 65 | "", 66 | "url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg ", 67 | "auto=true ", 68 | "net.ifnames=0 ", 69 | "hostname=localhost ", 70 | "" 71 | ], 72 | "http_directory": "http" 73 | } 74 | ], 75 | "provisioners": [ 76 | { 77 | "type": "shell", 78 | "script": "./install-virtualbox-guest-additions.sh" 79 | }, 80 | { 81 | "type": "ansible", 82 | "playbook_file": "./ansible/site.yml", 83 | "groups": [ 84 | "workers" 85 | ], 86 | "user": "{{user `USERNAME`}}", 87 | "extra_arguments": [ 88 | "--extra-vars", "ansible_python_interpreter='/usr/bin/env python3'" 89 | ], 90 | "ansible_env_vars": [ 91 | "ANSIBLE_FORCE_COLOR=1" 92 | ] 93 | } 94 | ] 95 | } 96 | -------------------------------------------------------------------------------- /examples/app/app.py: -------------------------------------------------------------------------------- 1 | import uuid, json, redis, flask 2 | 3 | COOKIE_NAME = "sessionID" 4 | 5 | def get_session_id(): 6 | """ Read session id from cookies, if present """ 7 | return flask.request.cookies.get(COOKIE_NAME) 8 | 9 | def set_session_id(response, override=False): 10 | """ Store session id in a cookie """ 11 | session_id = get_session_id() 12 | if not session_id or override: 13 | session_id = uuid.uuid4() 14 | response.set_cookie(COOKIE_NAME, str(session_id)) 15 | 16 | 17 | CACHE_CLIENT = redis.Redis(host="localhost", port=6379, db=0) 18 | 19 | # Chaos experiment 1 - uncomment this to add latency to Redis access 20 | #import chaos 21 | #CACHE_CLIENT = chaos.attach_chaos_if_enabled(CACHE_CLIENT) 22 | 23 | # Chaos experiment 2 - uncomment this to raise an exception every other call 24 | #import chaos2 25 | #@chaos2.raise_rediserror_every_other_time_if_enabled 26 | def get_interests(session): 27 | """ Retrieve interests stored in the cache for the session id """ 28 | return json.loads(CACHE_CLIENT.get(session) or "[]") 29 | 30 | def store_interests(session, query): 31 | """ Store last three queries in the cache backend """ 32 | stored = get_interests(session) 33 | if query and query not in stored: 34 | stored.append(query) 35 | stored = stored[-3:] 36 | CACHE_CLIENT.set(session, json.dumps(stored)) 37 | return stored 38 | 39 | 40 | def recommend_other_products(query, interests): 41 | """ Return a list of recommended products for a user, based on interests """ 42 | if interests: 43 | return {"this amazing product": "https://youtube.com/watch?v=dQw4w9WgXcQ"} 44 | return {} 45 | 46 | 47 | app = flask.Flask(__name__) 48 | 49 | @app.route("/") 50 | def index(): 51 | """ Handle the home page, search form """ 52 | resp = flask.make_response(""" 53 | 54 |
55 |

What would you like to buy today?

56 |

57 |

58 |
59 |

Recommendations. Reset.

60 | 61 | """) 62 | set_session_id(resp) 63 | return resp 64 | 65 | @app.route("/search", methods=["POST", "GET"]) 66 | def search(): 67 | """ Handle search, suggest other products """ 68 | session_id = get_session_id() 69 | query = flask.request.form.get("query") 70 | try: 71 | new_interests = store_interests(session_id, query) 72 | except redis.exceptions.RedisError as exc: 73 | print("LOG: redis error %s" % str(exc)) 74 | new_interests = None 75 | recommendations = recommend_other_products(query, new_interests) 76 | return flask.make_response(flask.render_template_string(""" 77 | 78 | {% if query %}

I didn't find anything for "{{ query }}"

{% endif %} 79 |

Since you're interested in {{ new_interests }}, why don't you try... 80 | {% for k, v in recommendations.items() %} {{ k }}{% endfor %}!

81 |

Session ID: {{ session_id }}. Go back.

82 | 83 | """, 84 | session_id=session_id, 85 | query=query, 86 | new_interests=new_interests, 87 | recommendations=recommendations, 88 | )) 89 | 90 | @app.route("/reset") 91 | def reset(): 92 | """ Reset the session ID cookie """ 93 | resp = flask.make_response(flask.redirect("/")) 94 | set_session_id(resp, override=True) 95 | return resp 96 | -------------------------------------------------------------------------------- /examples/who-you-gonna-call/src/generate_legacy.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python3 2 | 3 | import os 4 | 5 | # Ha! If only generating legacy was this simple! 6 | 7 | BUZZWORDS = sorted([ 8 | "pivot", 9 | "ai", 10 | "disrupt", 11 | "deep_dive", 12 | "agile", 13 | "unicorn", 14 | "crypto", 15 | "previous_legacy", 16 | "next_gen", 17 | "big_data", 18 | "machine_learning", 19 | "web_scale", 20 | "accelerator", 21 | "data_mining", 22 | "map_reduce", 23 | "fission", 24 | "preprocessing", 25 | "networking", 26 | "cloud", 27 | "enterprise_ready", 28 | "grpc", 29 | "new_4g", 30 | "organic", 31 | "free_range", 32 | "saas", 33 | "iaas", 34 | "paas", 35 | "internet_of_things", 36 | "private_cloud", 37 | "microservices", 38 | "monolith", 39 | "container", 40 | "virtualization", 41 | "simulation", 42 | "emulator", 43 | "bleeding_edge", 44 | "blockchain", 45 | "scalability", 46 | "lean", 47 | "abandonware" 48 | ]) 49 | 50 | EMBED = """Rickroll! """ 51 | 52 | FUNC_TEMPLATE = """ 53 | #include "../respond.h" 54 | #include "{next_name}.h" 55 | #include 56 | 57 | ssize_t {name}(int fd) {{ 58 | char a = {val1}, {name}_b = {val2}, {name}_{name} = {val3}; 59 | for (int i = 0; i < {offset}; i++){{ 60 | a++; {name}_b++; 61 | }} 62 | // not sure why, this didn't work with ++ 63 | // TODO check why it wasn't working 64 | {name}_{name} -= {offset} * -1; 65 | char size = '3'; 66 | // migration to retire the content-type: chunked 67 | // migration status: 90% 68 | //respond(fd, &size, sizeof(size)); 69 | //char newline[] = "\\r\\n"; 70 | //respond(fd, newline, sizeof(newline)-1); 71 | respond(fd, &a, sizeof(a)); 72 | respond(fd, &{name}_b, sizeof(a)); // maybe should be {name}_b? It wouldn't compile 73 | ssize_t r = respond(fd, &{name}_{name}, sizeof({name}_{name})); 74 | //respond(fd, newline, sizeof(newline)-1); 75 | // TODO prevent stack overflow 76 | {next_call}; 77 | return 0; // TODO return something more meaningful 78 | }} 79 | """ 80 | 81 | HEADER_TEMPLATE = """ 82 | #include 83 | 84 | ssize_t {name}(int); 85 | """ 86 | 87 | WRITER_TEMPLATE = """ 88 | #include 89 | #include "{name}.h" 90 | 91 | ssize_t write_content(int fd){{ 92 | // Not sure what else should go here, but here's for nothing 93 | {name}(fd); 94 | // TODO return something useful 95 | // TODO error handling 96 | return 0; 97 | }} 98 | """ 99 | 100 | WRITER_HEADER_TEMPLATE = """ 101 | #include 102 | #define CTN_LENGTH "{len}" 103 | 104 | ssize_t write_content(int); 105 | """ 106 | 107 | def generate_func(name, next_name, content, content_offset): 108 | offset = 3 109 | substring = content[content_offset:content_offset+3] 110 | header = HEADER_TEMPLATE.format( 111 | name=name, 112 | ) 113 | body = FUNC_TEMPLATE.format( 114 | name=name, 115 | next_name=next_name if next_name else name, 116 | offset=offset, 117 | next_call="if (r >= 0 || errno != EPIPE) {}(fd);".format(next_name) if next_name else "", 118 | val1=ord(substring[0]) - offset, 119 | val2=ord(substring[1]) - offset, 120 | val3=ord(substring[2]) - offset, 121 | ) 122 | return header, body 123 | 124 | 125 | def generate_all(names, content): 126 | os.makedirs("./legacy",exist_ok=True) 127 | offset = 0 128 | index = 0 129 | next_index = 1 130 | generation = 0 131 | next_name = "" 132 | while offset + 6 < len(content): 133 | name = "{}_{}".format(names[index], generation) 134 | next_index += 1 135 | if next_index >= len(names): 136 | generation += 1 137 | next_index = 0 138 | next_name = "{}_{}".format(names[next_index], generation) 139 | # plug into the system 140 | if index == 0 and generation == 0: 141 | with open("./legacy/writer.c", "w") as f: 142 | f.write(WRITER_TEMPLATE.format( 143 | name=name, 144 | len=len(content), 145 | )) 146 | with open("./legacy/writer.h", "w") as f: 147 | f.write(WRITER_HEADER_TEMPLATE.format( 148 | len=len(content) //3 *3, 149 | )) 150 | header, body = generate_func(name, next_name, content, offset) 151 | with open("./legacy/{}.h".format(name), "w") as f: 152 | f.write(header) 153 | with open("./legacy/{}.c".format(name), "w") as f: 154 | f.write(body) 155 | index = next_index 156 | offset += 3 157 | # handle the last one 158 | header, body = generate_func(next_name, None, content, offset) 159 | with open("./legacy/{}.h".format(next_name), "w") as f: 160 | f.write(header) 161 | with open("./legacy/{}.c".format(next_name), "w") as f: 162 | f.write(body) 163 | 164 | generate_all(BUZZWORDS, EMBED) 165 | -------------------------------------------------------------------------------- /vm/ansible/prerequisites/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Install apt repositories 3 | become: true 4 | apt_repository: 5 | repo: "{{ item }}" 6 | state: present 7 | loop: "{{ apt_repositories }}" 8 | 9 | - name: Install grafana's key and apt-repo 10 | shell: | 11 | sudo apt-get install -y apt-transport-https 12 | sudo apt-get install -y software-properties-common wget 13 | wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add - 14 | sudo add-apt-repository "deb https://packages.grafana.com/oss/deb stable main" 15 | 16 | - name: Remove some packages 17 | become: true 18 | apt: 19 | name: "{{ item }}" 20 | state: absent 21 | update_cache: yes 22 | loop: "{{ packages_to_remove }}" 23 | 24 | - name: Preinstall packages 25 | become: true 26 | apt: 27 | name: "{{ item }}" 28 | state: present 29 | update_cache: yes 30 | loop: "{{ packages_to_install }}" 31 | 32 | - name: Check out the book source code to home 33 | git: 34 | repo: 'https://github.com/seeker89/chaos-engineering-in-action.git' 35 | dest: /home/chaos/src 36 | 37 | - name: Make all the examples 38 | shell: make 39 | args: 40 | chdir: /home/chaos/src 41 | 42 | - name: Install kind 43 | shell: | 44 | curl -Lo ./kind "https://github.com/kubernetes-sigs/kind/releases/download/v0.7.0/kind-$(uname)-amd64" 45 | chmod +x ./kind 46 | sudo mv ./kind /usr/bin/kind 47 | exit 0 48 | args: 49 | creates: /usr/bin/kind 50 | 51 | - name: Install kubectl 52 | shell: | 53 | curl -Lo ./kubectl "https://storage.googleapis.com/kubernetes-release/release/v1.17.0/bin/linux/amd64/kubectl" 54 | chmod +x ./kubectl 55 | sudo mv ./kubectl /usr/bin/kubectl 56 | echo 'source <(kubectl completion bash)' >>~/.bashrc 57 | echo 'alias k=kubectl' >>~/.bashrc 58 | echo 'complete -F __start_kubectl k' >>~/.bashrc 59 | exit 0 60 | args: 61 | creates: /usr/bin/kubectl 62 | 63 | - name: Install pumba 64 | shell: | 65 | curl -Lo ./pumba "https://github.com/alexei-led/pumba/releases/download/0.6.8/pumba_linux_amd64" 66 | chmod +x ./pumba 67 | sudo mv ./pumba /usr/bin/pumba 68 | exit 0 69 | args: 70 | creates: /usr/bin/pumba 71 | 72 | - name: Allow insecure access to docker socket 73 | shell: | 74 | sudo setfacl -m user:$USER:rw /var/run/docker.sock 75 | sudo usermod -aG docker $USER 76 | exit 0 77 | 78 | # - name: Load kind images onto nodes 79 | # shell: | 80 | # kind create cluster 81 | # kind delete cluster 82 | # exit 0 83 | 84 | - name: Pre-pull some images into docker 85 | shell: | 86 | docker pull {{ item }} 87 | loop: "{{ docker_images_to_pull }}" 88 | 89 | - name: Retag some images 90 | become: true 91 | shell: | 92 | docker tag ubuntu:focal-20200423 ubuntu:focal 93 | 94 | - name: Disable docker starting on boot 95 | shell: | 96 | sudo systemctl disable docker 97 | sudo systemctl stop docker 98 | 99 | # to avoid surprises, always overcommit the memory 100 | - name: Always overcommit the memory 101 | become: true 102 | shell: | 103 | echo 1 > /proc/sys/vm/overcommit_memory 104 | 105 | - name: Prebuild python 3.7 from source with dtrace support 106 | shell: | 107 | # install the dependencies 108 | sudo apt-get install -y build-essential 109 | sudo apt-get install -y checkinstall 110 | sudo apt-get install -y libreadline-gplv2-dev 111 | sudo apt-get install -y libncursesw5-dev 112 | sudo apt-get install -y libssl-dev 113 | sudo apt-get install -y libsqlite3-dev 114 | sudo apt-get install -y tk-dev 115 | sudo apt-get install -y libgdbm-dev 116 | sudo apt-get install -y libc6-dev 117 | sudo apt-get install -y libbz2-dev 118 | sudo apt-get install -y zlib1g-dev 119 | sudo apt-get install -y openssl 120 | sudo apt-get install -y libffi-dev 121 | sudo apt-get install -y python3-dev 122 | sudo apt-get install -y python3-setuptools 123 | sudo apt-get install -y wget 124 | # download 125 | cd ~ 126 | curl -o Python-3.7.0.tgz https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz 127 | tar -xzf Python-3.7.0.tgz 128 | cd Python-3.7.0 129 | ./configure --with-dtrace --without-tests 130 | make 131 | #make test 132 | sudo make install 133 | make clean 134 | ./python --version 135 | cd .. 136 | rm Python-3.7.0.tgz 137 | 138 | - name: Install pip dependencies 139 | become: true 140 | pip: 141 | name: freegames 142 | 143 | # WORDPRESS, APACHE 144 | - name: Create a Wordpress site for apache 145 | become: true 146 | template: 147 | src: wordpress-site 148 | dest: /etc/apache2/sites-available/wordpress.conf 149 | 150 | - name: Create Wordpress DB config 151 | become: true 152 | template: 153 | src: config-localhost.php 154 | dest: /etc/wordpress/config-localhost.php 155 | 156 | - name: Enable the wordpress site in apache 157 | become: true 158 | shell: | 159 | a2ensite wordpress 160 | service apache2 reload || true 161 | 162 | - name: Create the wordpress database 163 | become: true 164 | shell: | 165 | cat <