Skip to content

Instantly share code, notes, and snippets.

@phstudy
phstudy / parallels-reset.sh
Created June 29, 2023 06:30 — forked from gdurastanti/parallels-reset.sh
Reset Parallels' trial
#!/bin/sh
# Reset Parallels Desktop's trial and generate a casual email address to register a new user
rm /private/var/root/Library/Preferences/com.parallels.desktop.plist /Library/Preferences/Parallels/licenses.xml
jot -w pdu%d@gmail.com -r 1
@phstudy
phstudy / HyperLogLogStoreUDAF.scala
Created June 6, 2017 17:12 — forked from MLnick/HyperLogLogStoreUDAF.scala
Experimenting with Spark SQL UDAF - HyperLogLog UDAF for distinct counts, that stores the actual HLL for each row to allow further aggregation
class HyperLogLogStoreUDAF extends UserDefinedAggregateFunction {
override def inputSchema = new StructType()
.add("stringInput", BinaryType)
override def update(buffer: MutableAggregationBuffer, input: Row) = {
// This input Row only has a single column storing the input value in String (or other Binary data).
// We only update the buffer when the input value is not null.
if (!input.isNullAt(0)) {
if (buffer.isNullAt(0)) {
@phstudy
phstudy / gist:fdf40c04feb1b52c99e7bc2fe843bf56
Created June 1, 2017 15:11 — forked from saetia/gist:1623487
Clean Install – OS X 10.11 El Capitan

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat
@phstudy
phstudy / gist:c180afa138325a4bd8fe7c566d1ed839
Created June 1, 2017 15:11 — forked from saetia/gist:1623487
Clean Install – OS X 10.11 El Capitan

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat
@phstudy
phstudy / install.md
Created June 1, 2017 15:10 — forked from hlb/Brewfile
clean install

System Preferences

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat
defaults write NSGlobalDomain InitialKeyRepeat -int 12

# Set a blazingly fast keyboard repeat rate
@phstudy
phstudy / ncdc.sh
Last active July 22, 2019 17:34 — forked from aligusnet/ncdc.sh
Download a weather dataset from the National Climatic Data Center (NCDC, http://www .ncdc.noaa.gov/). Prepare it for examples of "Hadoop: The Definitive Guide" book by Tom White. http://www.amazon.com/Hadoop-Definitive-Guide-Tom-White/dp/1449311520Usage:./ncdc.sh 1901 1930 # download wheather datasets for period from 1901 to 1930.
#!/usr/bin/env bash
# global parameters
g_tmp_folder="ncdc_tmp";
g_output_folder="ncdc_data";
g_remote_host="ftp.ncdc.noaa.gov";
g_remote_path="pub/data/noaa";
@phstudy
phstudy / Iterables.java
Last active June 4, 2016 16:59 — forked from popcornylu/Iterables.java
Iterable transformation
import org.apache.commons.collections4.IterableUtils;
import java.util.function.Function;
public class Iterables {
public static <F, T> Iterable<T> map(
Iterable<F> iterable,
Function<F, T> mapper) {
return IterableUtils.transformedIterable(iterable, (x) -> mapper.apply(x));
}