Skip to content

Instantly share code, notes, and snippets.

View pars3c's full-sized avatar

Adérito Xavier pars3c

View GitHub Profile
@pars3c
pars3c / main.tf
Last active June 28, 2020 18:07
Terraform file to generate a Dark Web Crawler
# Filename: main.tf
# Configure GCP project
provider "google" {
project = "terraform-cr"
}
# Deploy image to Cloud Run
resource "google_cloud_run_service" "comicbook-crawler" {
name = "comicbook-crawler"
location = "europe-west2"
template {
@pars3c
pars3c / index.js
Last active June 28, 2020 17:55
Comic Book Crawler
const Apify = require('apify');
const fs = require('fs');
const b2CloudStorage = require('b2-cloud-storage');
async function backblazeUpload () {
return new Promise(resolve => {
const b2 = new b2CloudStorage({
auth: {
accountId: '<account_id>',
applicationKey: '<application_key>'
@pars3c
pars3c / torrc
Last active June 14, 2020 11:46
Tor configuration file
## Configuration file for a typical Tor user
## Last updated 28 February 2019 for Tor 0.3.5.1-alpha.
## (may or may not work for much older or much newer versions of Tor.)
##
## Lines that begin with "## " try to explain what's going on. Lines
## that begin with just "#" are disabled commands: you can enable them
## by removing the "#" symbol.
##
## See 'man tor', or https://www.torproject.org/docs/tor-manual.html,
## for more options you can use in this file.
@pars3c
pars3c / index.js
Last active September 2, 2021 11:32
Coolblue crawler
const Apify = require('apify');
const fs = require('fs');
Apify.main(async () => {
// Create a requestQueue
const requestQueue = await Apify.openRequestQueue();
// Add the first requests to the queue
await requestQueue.addRequest({ url: 'https://www.coolblue.nl/sitemap/nl_en/products_1.xml' });
await requestQueue.addRequest({ url: 'https://www.coolblue.nl/sitemap/nl_en/products_2.xml' });
@pars3c
pars3c / nomad_job.hcl
Last active March 24, 2020 20:17
Job Specifications
# Name of your job
job "my_job" {
# Which region are you running your job
datacenters = ["dc1"]
/*
Job type can be "service", "batch" or "system".
A "service" job is made for long lived services that should never go down,
Service jobs are made to run until explicitly stopped by the operator.
A "batch" job is made for short lived operations which can last
@pars3c
pars3c / large_set_creation.py
Last active February 19, 2020 08:37
Dealing with large set patterns
# In case you are wondering about why the range goes to 101, that is because,
# the last argument is where it stops, meaning it will only reach the previous iteration (100).
# For more information check: https://www.geeksforgeeks.org/python-range-function/
our_set = {x for x in range(1, 101)}
print(our_set)
# or the easiest approach for newcomers.
our_set = set()
for x in range(1, 101):
@pars3c
pars3c / element_not_in_set.py
Last active February 19, 2020 08:20
Element not in the set
# Define set
my_set = {2, 5, 6}
(1 not in my_set) # 1 ∉ {2, 5, 6} also means {2, 5, 6} ∌ 1
@pars3c
pars3c / element_in_set.py
Last active February 19, 2020 08:19
Element within the set
# Define Set
my_set = {1, 2, 3}
(1 in my_set) # 1 ∈ {1, 2, 3} also means {1, 2, 3} ∋ 1
@pars3c
pars3c / sets.py
Last active February 16, 2020 18:43
How do sets work in Python
# Declare the set
my_set = {1, 2, 3, 4, 4}
print(my_set)
# Will output {1, 2, 3, 4}
# FUN NOTE: strings can also be added to sets in Python like {"Banana", "apple"},
# keep in mind it will still forbid repetition
@pars3c
pars3c / index.html
Created February 3, 2018 11:21
Login Page
<section class="login-cliente">
<div class="container">
<div class="row spaced-out">
<div class="col-md-6">
<h2>Login</h2>
<p>Aqui pode ver e alterar os seus dados pessoais, consultar uma listagem com os descontos e promoções de que já usufruiu e aceder aos seus vouchers.</p>
<label>Email</label>
<input type="email">