Skip to content

Instantly share code, notes, and snippets.

@marcusvolz
marcusvolz / butterfly_knn.R
Last active June 28, 2021 16:36
Butterfly knn
# The curve is a generalisation of the butterfly curve (Fay, 1989)
# See the Wiki for details: https://en.wikipedia.org/wiki/Butterfly_curve_(transcendental)
# Load packages
library(mathart) # devtools::install_github("marcusvolz/mathart")
library(tidyverse)
# Set parameters
n <- 1000
a <- 2
@marcusvolz
marcusvolz / procedural_ring.R
Last active June 28, 2021 16:28
Procedural ring
# Load packages
library(generative) # devtools::install_github("marcusvolz/generative")
library(ggplot2)
# Set parameters (see generative::procedural_ring documentation for details)
seed <- 3
n <- 400
n_circles <- 4
r_0 <- 500
eps <- 500
/**
* Interface for getting the instance of binder from our service class
* So client can get instance of our service class and can directly communicate with it.
*/
private val serviceConnection = object : ServiceConnection {
override fun onServiceConnected(className: ComponentName, iBinder: IBinder) {
Log.d(mTAG, "ServiceConnection: connected to service.")
// We've bound to MyService, cast the IBinder and get MyBinder instance
val binder = iBinder as MyBinder
mService = binder.service
@marcusvolz
marcusvolz / rose_knn.R
Last active June 28, 2021 16:37
Rose curve k-nearest neighbour graph
# Load packages
library(mathart) # devtools::install_github("marcusvolz/mathart")
library(tidyverse)
# Set parameters
# Rose curve wiki: https://en.m.wikipedia.org/wiki/Rose_(mathematics)
# Nearest neighbour graph wiki: https://en.m.wikipedia.org/wiki/Nearest_neighbor_graph
n <- 9
d <- 8 # Note: k = n/d is a curve parameter
N <- 11 # Controls the total curve length
<?xml version="1.0" encoding="UTF-8"?>
<gpx creator="StravaGPX Android" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd" version="1.1" xmlns="http://www.topografix.com/GPX/1/1">
<metadata>
<time>2020-03-03T09:01:56Z</time>
</metadata>
<trk>
<name>Morning Walk</name>
<type>10</type>
<trkseg>
<trkpt lat="48.0052760" lon="21.7257150">
@withakay
withakay / windows-vpn.ps1
Created December 11, 2019 16:20
Windows VPN
# Path for the public phonebook. Used as this is an all users connection.
# Change $env:PROGRAMDATA to $env:APPDATA if not creating an AllUserConnection.
$PbkPath = Join-Path $env:PROGRAMDATA 'Microsoft\Network\Connections\Pbk\rasphone.Pbk'
# Update these variables with the actual VPN name, address, and PSK.
$ConnectionName = 'ArrayString0',"ArrayString1", "ArracyString3","ArracyString4"
$ServerAddress = 'meraki-dynamic-ip-address-dynamic-m.com','meraki-dynamic-ip-address-dynamic-m.com','meraki-dynamic-ip-address-dynamic-m.com','meraki-dynamic-ip-address-dynamic-m.com'
$PresharedKey = 'PreSharedKeySecret'
# If no VPNs, rasphone.Pbk may not already exist
@robertmryan
robertmryan / SnapshotWithMarkerView.swift
Last active July 9, 2021 07:06
MKMapSnapshotter with MKMarkerAnnotationView - https://stackoverflow.com/q/58613580/1271826
func generateMap(with coordinates: [CLLocationCoordinate2D]) {
var annotationViews = [MKMarkerAnnotationView]()
let startCoord = coordinates.first!
let endCoord = coordinates.last!
annotationViews.append(createMapMarkerAnnotation(text: "A", coordinates: startCoord, color: .green))
annotationViews.append(createMapMarkerAnnotation(text: "B", coordinates: endCoord, color: .green))
let snapshotter = MKMapSnapshotter(options: options)
snapshotter.start { snapshot, error in
@k1p1
k1p1 / gist:50c373e27e2a78f05c5e053492c09316
Created October 4, 2019 13:33
Unreal Engine 4 .gitattributes LFS
# Unreal Engine file types.
*.uasset filter=lfs diff=lfs merge=lfs -text
*.umap filter=lfs diff=lfs merge=lfs -text
# Raw Content file types.
*.fbx filter=lfs diff=lfs merge=lfs -text
*.3ds filter=lfs diff=lfs merge=lfs -text
*.psd filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.mp3 filter=lfs diff=lfs merge=lfs -text
@drilonrecica
drilonrecica / android-version-and-tag-automation.sh
Last active May 30, 2024 05:48
Bash script for automating versioning (versionCode & versionName) and setting git Tag in an android project
# Proccess:
# 1. Go into app directory
# 2. Get current versionCode and print it
# 3. Increment versionCode by one and print it
# 4. Get current versionName and print it
# 5. Ask user for new versionName and set it then print it
# 6. Stage changes to build.gradle
# 7. Go back one directory to project root
# 8. Commit version update with message Bumped up version
# 9. Tag with versionName
@xuhaibahmad
xuhaibahmad / SystemPropertyInteractor.java
Created September 26, 2019 05:52
A wrapper to read Android system properties using reflection
import java.io.File;
import java.lang.reflect.Method;
import android.content.Context;
import dalvik.system.DexFile;
public class SystemPropertiesProxy
{
/**