This file contains 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 python3 | |
import socket | |
from time import sleep | |
import sys | |
hostname = 'alarm.local' | |
port = 6600 | |
password = 'secret123' |
This file contains 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
Copyright (c) 2016 Fabian Muscariello | |
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE U |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
-- Various bits and pieces of code that turned out to be useful for the 'Load' step of ETL | |
-- (i.e., loading big chunks of data into postgres tables). | |
-- postgres' COPY is more efficient than a bunch of INSERT statements: | |
\copy table_name (col1, col2, …) from '/path/to/file.txt' | |
-- If the text file to load the data from is unusually large, it can also be unzipped. Note that, regardless of which of the | |
-- two methods is used (loading directly from a file or unzipping it first with zcat), this will *not* load the entire file | |
-- into memory, so this method can also be used for very large files even if both server and client have little memory available. | |
\copy table_name (col1, col2, …) from program 'zcat /path/to/file.txt.gz' |
This file contains 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
@doc""" | |
Returns a map containing all files and their contents from the compressed tar archive. | |
""" | |
def extract_tar_from_binary(binary) do | |
with {:ok, files} <- :erl_tar.extract({:binary, binary}, [:memory, :compressed]) do | |
files | |
|> Enum.map(fn {filename, content} -> {to_string(filename), content} end) | |
|> Map.new | |
end | |
end |
This file contains 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
// #![deny(warnings)] | |
use std::time::Duration; | |
use futures::executor::block_on; | |
use std::net::{TcpListener, TcpStream}; | |
use std::sync::atomic::{AtomicUsize, Ordering}; | |
static REQUEST_COUNT: AtomicUsize = AtomicUsize::new(0); | |
#[tokio::main] |
This file contains 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
[0.096346981s] [INFO ] [alacritty] glutin event: DeviceEvent { device_id: DeviceId(X(DeviceId(15))), event: Key(KeyboardInput { scancode: 28, state: Released, virtual_keycode: Some(Return), modifiers: (empty) }) } | |
[1.787554907s] [INFO ] [alacritty] glutin event: DeviceEvent { device_id: DeviceId(X(DeviceId(15))), event: Key(KeyboardInput { scancode: 29, state: Pressed, virtual_keycode: Some(LControl), modifiers: (empty) }) } | |
[1.787633465s] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(X(WindowId(144703490))), event: KeyboardInput { device_id: DeviceId(X(DeviceId(3))), input: KeyboardInput { scancode: 29, state: Pressed, virtual_keycode: Some(LControl), modifiers: CTRL }, is_synthetic: false } } | |
[2.681567809s] [INFO ] [alacritty] glutin event: DeviceEvent { device_id: DeviceId(X(DeviceId(15))), event: Key(KeyboardInput { scancode: 25, state: Pressed, virtual_keycode: Some(P), modifiers: CTRL }) } | |
[2.681635087s] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(X(WindowId |
This file contains 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
[3.116006287s] [INFO ] [alacritty] glutin event: DeviceEvent { device_id: DeviceId(X(DeviceId(15))), event: Key(KeyboardInput { scancode: 29, state: Pressed, virtual_keycode: Some(LControl), modifiers: (empty) }) } | |
[3.116068624s] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(X(WindowId(144703490))), event: KeyboardInput { device_id: DeviceId(X(DeviceId(3))), input: KeyboardInput { scancode: 29, state: Pressed, virtual_keycode: Some(LControl), modifiers: CTRL }, is_synthetic: false } } | |
[3.471187498s] [INFO ] [alacritty] glutin event: DeviceEvent { device_id: DeviceId(X(DeviceId(15))), event: Key(KeyboardInput { scancode: 37, state: Pressed, virtual_keycode: Some(K), modifiers: CTRL }) } | |
[3.471222794s] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(X(WindowId(144703490))), event: KeyboardInput { device_id: DeviceId(X(DeviceId(3))), input: KeyboardInput { scancode: 37, state: Pressed, virtual_keycode: Some(K), modifiers: CTRL }, is_synthetic: false } } | |
[3.528097763s] [I |
This file contains 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 python3 | |
import argparse | |
import datetime | |
import requests | |
import tarfile | |
import tempfile | |
import gzip | |
import os | |
import hashlib |