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
version: '3.7' | |
services: | |
localstack: | |
image: localstack/localstack:3.0.2 | |
deploy: | |
placement: | |
constraints: [node.labels.localstack == true] | |
# Exposing ports on will result into Internal Server Error ("Could not attach to network ingress: rpc error: code = PermissionDenied desc = network ingress not manually attachable") | |
environment: |
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
class Tweet(TimestampedModelMixin): | |
""" | |
Tweet model | |
""" | |
tweet_id = models.BigIntegerField(primary_key=True) | |
content = models.CharField(max_length=1024, help_text=_("Tweet Content")) | |
deleted_at = models.DateTimeField(blank=True, null=True, db_index=True,) |
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
FROM cfa/base_image as base | |
EXPOSE 8000 | |
# Install Python dependencies specific to debunkbot | |
COPY requirements.txt /var/tmp/ | |
RUN pip3 install -r /var/tmp/requirements.txt && rm /var/tmp/requirements.txt && rm -rf /root/.cache/ | |
COPY . /opt/cfa/src/debunkbot/ |
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
FROM ubuntu@sha256:9c152418e380c6e6dd7e19567bb6762b67e22b1d0612e4f5074bda6e6040c64a as ubuntu-22.04 | |
RUN apt update && apt upgrade -y | |
RUN apt install -y wget build-essential zlib1g-dev libssl-dev | |
# Install Python | |
RUN wget https://www.python.org/ftp/python/3.10.2/Python-3.10.2.tgz && \ | |
tar xzf Python-3.10.2.tgz && \ | |
cd Python-3.10.2 && \ |
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
const request = require('request'); | |
const cheerio = require('cheerio'); | |
const url = 'https://browser.geekbench.com/'; | |
async function getData(url) { | |
let requests = []; | |
return new Promise((resolve, reject) => { |
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 python | |
import os | |
import subprocess | |
import re | |
import shutil | |
def get_statistics(): | |
statistics = {} |
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
# Network latency | |
""" | |
Here we will ping google at an interval of five seconds for five times and record the | |
min response time, average response time, and the max response time. | |
""" | |
ping_result = subprocess.run(['ping', '-i 5', '-c 5', 'google.com'], stdout=subprocess.PIPE).stdout.decode('utf-8').split('\n') | |
min, avg, max = ping_result[-2].split('=')[-1].split('/')[:3] | |
statistics['network_latency'] = dict( | |
{ |
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
import shutil | |
import subprocess | |
statistics = {} | |
# Top command on mac displays and updates sorted information about processes. | |
top_command = subprocess.run(['top', '-l 1', '-n 0'], stdout=subprocess.PIPE).stdout.decode('utf-8').split('\n') | |
# Disk usage |
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
import subprocess | |
import re | |
statistics = {} | |
matcher = re.compile('\d+') | |
# Memory usage | |
total_ram = subprocess.run(['sysctl', 'hw.memsize'], stdout=subprocess.PIPE).stdout.decode('utf-8') | |
vm = subprocess.Popen(['vm_stat'], stdout=subprocess.PIPE).communicate()[0].decode('utf-8') | |
vmLines = vm.split('\n') |
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
import os | |
import subprocess | |
import re | |
statistics = {} | |
# Get Physical and Logical CPU Count | |
physical_and_logical_cpu_count = os.cpu_count() | |
statistics['physical_and_logical_cpu_count'] = physical_and_logical_cpu_count | |
""" |
NewerOlder