Live Table: https://diafygi.github.io/webcrypto-examples/
I couldn't find anywhere that had clear examples of WebCryptoAPI, so I wrote examples and made a live table with them. Pull requests welcome!
- generateKey | importKey |
Live Table: https://diafygi.github.io/webcrypto-examples/
I couldn't find anywhere that had clear examples of WebCryptoAPI, so I wrote examples and made a live table with them. Pull requests welcome!
| # Set AWS credentials and S3 paramters | |
| AWS_KEY="" | |
| AWS_SECRET="" | |
| S3_BUCKET="" | |
| S3_BUCKET_PATH="/" | |
| S3_ACL="x-amz-acl:private" | |
| function s3Upload | |
| { | |
| path=$1 |
| import asyncio | |
| class EchoServerClientProtocol(asyncio.Protocol): | |
| def connection_made(self, transport): | |
| self.transport = transport | |
| self.peername = transport.get_extra_info('peername') | |
| print('Connection from {}'.format(self.peername)) | |
| def data_received(self, data): |
More on ECDSA
Info on bit length and complexity
From it you may gather that using 256 bit ECDSA key should be enough for next 10-20 years.
To view your available curves
| #!/usr/bin/nft -f | |
| # ipv4/ipv6 Simple & Safe Firewall | |
| # you can find examples in /usr/share/nftables/ | |
| flush ruleset | |
| table firewall { | |
| chain incoming { | |
| type filter hook input priority 0; |
| # MariaDB Tuning | |
| vm.swappiness = 1 | |
| fs.file-max = 2097152 | |
| vm.dirty_ratio = 60 | |
| vm.dirty_background_ratio = 2 | |
| # Sets the time before the kernel considers migrating a proccess to another core | |
| kernel.sched_migration_cost_ns = 5000000 | |
| # Group tasks by TTY |
Services declared as oneshot are expected to take some action and exit immediatelly (thus, they are not really services,
no running processes remain). A common pattern for these type of service is to be defined by a setup and a teardown action.
Let's create a example foo service that when started creates a file, and when stopped it deletes it.
Create executable file /opt/foo/setup-foo.sh:
| <?php | |
| $key = "<API Key>"; | |
| $from = "info@example.com"; | |
| $to = "dave@example.com"; | |
| if ($_SERVER['REQUEST_METHOD'] == 'POST') { | |
| if(isset($_POST['timestamp']) && isset($_POST['token']) && isset($_POST['signature']) && hash_hmac('sha256', $_POST['timestamp'] . $_POST['token'], $key) === $_POST['signature']) | |
| { | |
| if($_POST['event'] == 'complained') { |
| #include <stdio.h> | |
| #include <arpa/inet.h> //INET6_ADDRSTRLEN | |
| #include <miniupnpc/miniupnpc.h> | |
| #include <miniupnpc/upnpcommands.h> | |
| int main(int argc, char *argv[]) { | |
| int error = 0; | |
| //get a list of upnp devices (asks on the broadcast address and returns the responses) | |
| struct UPNPDev *upnp_dev = upnpDiscover(1000, //timeout in milliseconds | |
| NULL, //multicast address, default = "239.255.255.250" |
| # | |
| # Name: nginx-tls.conf | |
| # Auth: Gavin Lloyd <gavinhungry@gmail.com> | |
| # Desc: Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating | |
| # | |
| # Enables HTTP/2, PFS, HSTS and OCSP stapling. Configuration options not related | |
| # to SSL/TLS are not included here. | |
| # | |
| # Additional tips: | |
| # |