Skip to content

Instantly share code, notes, and snippets.

states = [
"Abia",
"Adamawa",
"Anambra",
"Akwa Ibom",
"Bauchi",
"Bayelsa",
"Benue",
"Borno",
"Cross River",
get symptoms of COVID-19
SELECT ?categoryLabel
?symptom ?symptomLabel
WHERE {
?category wdt:P31* wd:Q84263196 .
?category wdt:P780 ?symptom.
query = """
with $files as rows
unwind rows as row
unwind row.authors as authors
unwind row.Entity as entities
unwind row.sent_tag as sent
unwind keys(sent) as sent_key
unwind keys(entities) as entity_label
unwind entities[entity_label] as entities_value
unwind sent[sent_key] as tags
@hammedb197
hammedb197 / faster_toPandas.py
Created August 20, 2020 17:14 — forked from joshlk/faster_toPandas.py
PySpark faster toPandas using mapPartitions
import pandas as pd
def _map_to_pandas(rdds):
""" Needs to be here due to pickling issues """
return [pd.DataFrame(list(rdds))]
def toPandas(df, n_partitions=None):
"""
Returns the contents of `df` as a local `pandas.DataFrame` in a speedy fashion. The DataFrame is
repartitioned if `n_partitions` is passed.
import json
from time import sleep
from bs4 import BeautifulSoup
from kafka import KafkaConsumer, KafkaProducer
def publish_message(producer_instance, topic_name, key, value):
try:
key_bytes = bytes(key, encoding='utf-8')
# pip install python-snappy
import snappy
import json
file_name = 'transact.snappy'
input_data = json.dumps([{'a': 1, 'b': 2}])
def compress_(snappy_file):
data = snappy.compress(input_data)
return data
@hammedb197
hammedb197 / .tsx
Created December 17, 2022 13:17 — forked from dragosbulugean/.tsx
crisp
import * as React from 'react'
import { UserResponse } from '../shared/UserAPI'
import { getWindowVar } from './util'
export class CrispChat extends React.Component<{ user?: UserResponse }> {
async componentDidMount() {
// @ts-ignore
if (typeof window !== 'undefined' && !window['$crisp']) {
this.addMainScript()
}