Skip to content

Instantly share code, notes, and snippets.

View domderen's full-sized avatar

Dominik Deren domderen

  • Hyperion Gray
  • Poland
View GitHub Profile
import * as playwright from 'playwright';
/**
* Defines type used to extract complex values from the page.
*/
type CompositeSelector = {
selector?: string;
attributeName?: string;
}
from pathlib import Path
import sys
# from wireguard import Server
client_public_key = sys.argv[1]
server_private_key = sys.argv[2]
wg_interface_name = sys.argv[3] if len(sys.argv) > 3 else 'devenvsrv'
out_interface_name = sys.argv[4] if len(sys.argv) > 4 else 'ens5'
config_path = sys.argv[5] if len(sys.argv) > 5 else './'
# server = Server(
@domderen
domderen / install.sh
Last active April 17, 2022 06:28
Installation of apache spark on ubuntu machine.
#!/bin/sh
# installation of Oracle Java JDK.
sudo apt-get -y update
sudo apt-get -y install python-software-properties
sudo add-apt-repository -y ppa:webupd8team/java
sudo apt-get -y update
sudo apt-get -y install oracle-java7-installer
# Installation of commonly used python scipy tools
#!/bin/bash
echo "Installing CW Agent"
sudo yum install amazon-cloudwatch-agent -y
echo "Creating CW Agent config file"
cat > /opt/aws/amazon-cloudwatch-agent/bin/config.json <<EOL
{
"agent": {
"metrics_collection_interval": 60,
https://www.airbnb.com/rooms/21679018
https://www.airbnb.com/rooms/12797906
@domderen
domderen / Angular Overlay Directive
Created August 6, 2014 20:14
Angular directive for creating dynamic overlays over any element. Directive is automatically preparing parent to have an overlay, and dynamically sets the height of the overlay if the height of the parent will change. Second directive allows to set any element in the vertical and horizontal center of the parent element. It dynamically reposition…
var overlayModule = angular.module('angular-overlay', []).directive('elementOverlay', [function () {
return {
restrict: 'A',
link: function (scope, elem, attrs) {
$(elem[0].parentNode).css('position', 'relative');
scope.$watch(function () {
return $(elem[0].parentNode).height();
}, function (v) {
elem.css('height', v + 'px');
module.exports = {
topic: 'SomeTopic4'
}
￿
@domderen
domderen / README.md
Created December 3, 2016 12:41
Returns the contents of a single file from a GitHub repository, relying on standard Git authentication method.

GitHub repositories don't support git archive command, which allows getting content of a single file. A different method of getting file contents from GitHub is to use GitHub API with an access token, but this requires a different authentication method, and would require creating a special account in an org that could be used for example in CI systems. I wanted a method that relies on the same auth method as git clone for example, and still just gets the content of a single file.

Example usage:

./get_github_file.sh facebook react docs/README.md
// This is a simple approach to downloading the data from our API
// and processing it as JSON Object. This method is only sufficient for
// small API responses (should work for responses below 100k results).
// If your response contains more results, try having a look at this Stack Overflow QA:
// http://stackoverflow.com/questions/15121584/how-to-parse-a-large-newline-delimited-json-file-by-jsonstream-module-in-node-j
// We start by getting data from our API:
let extractorRunId = "00000000-0000-0000-0000-000000000000";
let jsonFieldId = "00000000-0000-0000-0000-000000000001"; // You can get this value, by displaying https://store.import.io/store/crawlrun/${extractorRunId} in the browser, and getting the value from `json` field.
let apiKey = "YOUR_API_KEY"; // You can get it here https://import.io/data/account/