Skip to content

Instantly share code, notes, and snippets.

@oripwk
oripwk / lonely-planet.js
Created November 26, 2022 10:34
Extracts sights information from Lonely Planet EPUB books and generates a KML file which then can be imported to a map software
let pois = document.querySelectorAll(".poi")
for (poi of pois) {
try {
let link = poi.querySelectorAll(".map-links")[0]
.querySelectorAll(".link_map")[1].parentElement.getAttribute("href");
let coordinatesText = new URL(link).searchParams.get('q');
let coordinatesList = coordinatesText.split(",")
let coordinates = `${coordinatesList[1]},${coordinatesList[0]}`;
let info = poi.querySelectorAll(".poi-line")[0].querySelectorAll(".name");
@oripwk
oripwk / Main.scala
Last active July 2, 2022 04:26
Françaises conjugaisons
import scala.io.StdIn
import scala.util.Random
object Main {
def main(args: Array[String]): Unit = {
val product: List[(String, String, String)] = for {
verb <- verbs.toList
person <- persons
time <- times
} yield (verb, person, time)
<?xml version="1.0" encoding="UTF-8"?>
<!--
Recommended way to edit .jfc files is to use Java Mission Control,
see Window -> Flight Recorder Template Manager.
-->
<configuration version="1.0" name="Profiling" description="Low overhead configuration for profiling, typically around 2 % overhead." provider="Oracle">
<producer uri="http://www.oracle.com/hotspot/jvm/" label="Oracle JDK">
#!/bin/sh
if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then
echo "usage: kinesis-tail <profile> <stream-name> <iterator-type> [region]"
exit 1
fi
if [ -n "$4" ]; then
export AWS_DEFAULT_REGION=$4
fi
@oripwk
oripwk / latest.scala
Created July 31, 2018 11:57
Structured Streaming filter only latest record per key
spark
.readStream
.format("socket")
.option("host", "127.0.0.1")
.option("port", 9999)
.load()
.as[String]
.map { value =>
val split = value.split(",")
(split(0), split(1))
# This script allows you to build any CircleCI project without pushing
# the whole project to Github with a new config.yml. This is ideal for
# trying out different builds without polluting commit history.
#
# everything is self explanatory, just generate the API token from CircleCI user menu.
curl -XPOST --user ${API_TOKEN}:\
--form revision=${GITHUB_COMMIT}\
--form config=@${CONFIG_YML}\
"https://circleci.com/api/v1.1/project/github/${ORG}/${REPO}/tree/${BRANCH}"
@oripwk
oripwk / whatsapp-restore.sh
Last active April 28, 2019 13:51
Restoring WhatsApp files timestamps after Google Drive restore
# when restoring WhatsApp in a new phone, all the timestamps of media files will be reset to today.
# this script will restore the original modification time of the files
cd WhatsApp/Media
while read path; do
f=$(basename "$path");
touch -m -d "${f:4:4}-${f:8:2}-${f:10:2}T12:00:00z" "${path}";
done < <(find . -regextype posix-extended -regex ".*/[[:alpha:]]{3}-[[:digit:]]{8}-.*")
@oripwk
oripwk / s.scala
Created September 1, 2016 18:52
Some code
object Main
def main(args: Array[String]) = {
println("this is scala")
}