The problem: software orchestration.
Like fabric, puppet, chef.
It is Built on YAML, is agentless (uses SSH), idempotent.
Configuration is called 'playbook'.
A group of actions is called a role.
You can define host groups, hosts, variables.
To test local provisionning, use vagrant.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def with_binding_from_hash(variables, &block) | |
| obj = Object.new | |
| variables.each do |key, value| | |
| obj.instance_variable_set("@#{key}", value) | |
| obj.define_singleton_method(key) { instance_variable_get("@#{key}") } | |
| end | |
| obj.instance_eval(&block) | |
| end | |
| def for_comprehension_with_guard(head, env) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| text = "Samaritan Report Threat Assessment and Mitigation Date Current Date Time Current Time Subject Anomalous Behavior Detection and Countermeasures Summary Anomalous patterns detected in the activities of individuals within Sector 12 Probability of disruptive behavior reaching critical levels 82.5% Immediate intervention recommended to maintain societal stability Key Identified Entities 1 Individual A High likelihood of initiating a protest Risk Level High Recommended Action Surveillance escalation preemptive detention 2 Individual B Potential hacker targeting critical infrastructure Risk Level Severe Recommended Action Network isolation neutralization 3 Group X Organization planning unauthorized public assembly Risk Level Moderate Recommended Action Infiltration and dispersion Detailed Analysis Behavioral Patterns Increased communications among identified entities suggest coordination Keyword analysis reveals topics related to dissent and mobilization Network Traffic Unusual spikes in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| call plug#begin('~/.config/nvim/plugged') | |
| Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } | |
| Plug 'junegunn/fzf.vim' | |
| call plug#end() | |
| "<fzf quickmarks> | |
| function! s:open_url_quickmark(line) | |
| silent execute '!firefox ' . shellescape(split(a:line)[-1], 1) | |
| endfunction |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import socket | |
| port_number = 4242 | |
| server_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
| server_socket.bind(('0.0.0.0', port_number)) | |
| print "UDPServer Waiting for client on port", port_number | |
| while True: print server_socket.recvfrom(1024) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'mittsu' | |
| class Game | |
| def bar | |
| left_bar_geometry = Mittsu::BoxGeometry.new(0.2, 0.05, 1.0) | |
| left_bar = Mittsu::Mesh.new(left_bar_geometry, Mittsu::MeshPhongMaterial.new(color: 0x888888)) | |
| @camera.add left_bar | |
| left_bar.position.y -= 0.4 | |
| left_bar.position.z -= 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from google.cloud import bigquery | |
| import sys | |
| bigquery_client = bigquery.Client( | |
| project = "my-project") | |
| query = bigquery_client.run_sync_query("select * from airflow.quotes_" + sys.argv[1]) | |
| query.run() | |
| dataset = bigquery_client.dataset("airflow") | |
| table = dataset.table("quotes") | |
| table.reload() | |
| result = table.insert_data(query.rows) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from airflow import DAG | |
| from airflow.operators.bash_operator import BashOperator | |
| from datetime import datetime, timedelta | |
| default_args = { | |
| 'owner': 'airflow', | |
| 'depends_on_past': False, | |
| 'start_date': datetime(2017, 1, 1), | |
| 'email': ['mymail@mail.net'], | |
| 'email_on_failure': False, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from airflow import DAG | |
| from airflow.operators.bash_operator import BashOperator | |
| from datetime import datetime, timedelta | |
| default_args = { | |
| 'owner': 'airflow', | |
| 'depends_on_past': False, | |
| 'start_date': datetime(2017, 1, 1), | |
| 'email': ['innov-analytics@teads.tv'], | |
| 'email_on_failure': False, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ==26249== | |
| ==26249== HEAP SUMMARY: | |
| ==26249== in use at exit: 32 bytes in 2 blocks | |
| ==26249== total heap usage: 5 allocs, 3 frees, 52 bytes allocated | |
| ==26249== | |
| ==26249== LEAK SUMMARY: | |
| ==26249== definitely lost: 0 bytes in 0 blocks | |
| ==26249== indirectly lost: 0 bytes in 0 blocks | |
| ==26249== possibly lost: 0 bytes in 0 blocks | |
| ==26249== still reachable: 32 bytes in 2 blocks |
NewerOlder