Skip to content

Instantly share code, notes, and snippets.

Avatar
😀
Focusing

Axel Pettersson Ackuq

😀
Focusing
View GitHub Profile
@Ackuq
Ackuq / yelp-experiments.py
Last active Jun 3, 2022
Experiment used to achieve benchmarks for executing point-in-time joins in Apache Spark using the Yelp dataset.
View yelp-experiments.py
# Hops
import hsfs
from hops import hdfs
# Spark
from pyspark.sql import DataFrame, SQLContext
from pyspark.sql.functions import col, lit
# Implementations
from hops.pit import PitContext
# SparkMeasure
from sparkmeasure import StageMetrics
View spark-pit-experiment.py
# Hops
import hsfs
from hops import hdfs
# Spark
from pyspark.sql import DataFrame, SQLContext
from pyspark.sql.functions import col, lit
# Implementations
from hops.pit import PitContext
# SparkMeasure
from sparkmeasure import StageMetrics
@Ackuq
Ackuq / yelp_preprocessing.py
Last active Jun 4, 2022
Pre-processing for the Yelp dataset
View yelp_preprocessing.py
from pyspark.sql import SparkSession
from pyspark.sql.functions import explode, split, to_timestamp
TS_FORMAT = "yyyy-MM-dd HH:mm:ss"
checkins_path = ...
tips_path = ...
spark = SparkSession.builder.master("local").appName("preprocessing").getOrCreate()
View api.js
import base64 from 'react-native-base64';
...
const auth = base64.encode(`${Config.WP_USERNAME}:${Config.WP_PASSWORD}`);
export const updateData = async (route, data) => {
try {
fetch(Config.API_URL + route, {
method: 'POST',
View .env
...
WP_USERNAME=[username]
WP_PASSWORD=[password]
View Posts.js
import React, { useEffect, useState } from 'react';
import { FlatList, SafeAreaView, Text } from 'react-native';
import PropTypes from 'prop-types';
import { fetchApiData } from '../../lib/api';
const Posts = ({ navigation }) => {
const [posts, setPosts] = useState([]);
const [page, setPage] = useState(1);
const [loading, setLoading] = useState(true);
View api.js
import Config from 'react-native-config';
export const fetchApiData = async route => {
try {
const response = await fetch(Config.API_URL + route);
const json = await response.json();
return json;
} catch (error) {
console.error(error);
return null;
@Ackuq
Ackuq / .env
Created Jul 31, 2019
Enviroment file
View .env
API_URL=https://[yourdomain]/wp-json/v2/