float rand(float n){return fract(sin(n) * 43758.5453123);}
float noise(float p){
float fl = floor(p);
float fc = fract(p);
return mix(rand(fl), rand(fl + 1.0), fc);
}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
streaming cartesian product elements uses less memory ... | |
*/ | |
const generator = cartesianProductSimplified(['a', 'b'], [1, 2, 3, 4], ['x', 'y', 'z']); | |
/* prints | |
[ 'a', 1, 'x' ] | |
[ 'a', 1, 'y' ] | |
[ 'a', 1, 'z' ] | |
[ 'a', 2, 'x' ] | |
[ 'a', 2, 'y' ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "Finder" to set theSel to selection as alias list | |
repeat with i from 1 to count of theSel | |
set item i of theSel to POSIX path of item i of theSel | |
end repeat | |
return theSel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set theDMG to choose file with prompt "Please select javaforosx.dmg:" of type {"dmg"} | |
do shell script "hdiutil mount " & quoted form of POSIX path of theDMG | |
do shell script "pkgutil --expand \"/Volumes/Java for macOS 2017-001/JavaForOSX.pkg\" ~/tmp" | |
do shell script "hdiutil unmount \"/Volumes/Java for macOS 2017-001/\"" | |
do shell script "sed -i '' 's/return false/return true/g' ~/tmp/Distribution" | |
do shell script "pkgutil --flatten ~/tmp ~/Desktop/Java.pkg" | |
do shell script "rm -rf ~/tmp" | |
display dialog "Modified Java.pkg saved on desktop" buttons {"Ok"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SCRIPT TO GZIP CRITICAL FILES FOR ACCELERATED WEBSERVING | |
# see also https://community.platformio.org/t/question-esp32-compress-files-in-data-to-gzip-before-upload-possible-to-spiffs/6274/10 | |
# | |
# todo : add minify js | |
# todo : exclude files with _ at begginging | |
Import( 'env', 'projenv' ) | |
import os |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Store 32-bit floating point number within three 8bit channels of a 32-bit RGBA pixel. | |
# Only suitable for normalised input values in the range [0.0, 1.0). | |
# | |
# Refer: https://aras-p.info/blog/2009/07/30/encoding-floats-to-rgba-the-final/ | |
import numpy as np | |
def frac(x): | |
return x - np.floor(x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Variables used by Scriptable. | |
// These must be at the very top of the file. Do not edit. | |
// icon-color: gray; icon-glyph: magic; | |
const require = loadModule('scriptablify'); | |
// Defaults to the latest version and no automatic update; if the file exists, just use it | |
const moment = await require('moment'); | |
// Use any SemVer options to specify a version you want |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
iatest=$(expr index "$-" i) | |
####################################################### | |
# SOURCED ALIAS'S AND SCRIPTS BY zachbrowne.me | |
####################################################### | |
# Source global definitions | |
if [ -f /etc/bashrc ]; then | |
. /etc/bashrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo su | |
cd /root/ | |
wget https://www.softether-download.com/files/softether/v4.34-9745-rtm-2020.04.05-tree/Linux/SoftEther_VPN_Server/32bit_-_ARM_EABI/softether-vpnserver-v4.34-9745-rtm-2020.04.05-linux-arm_eabi-32bit.tar.gz | |
tar xzf softether-vpnserver-v4.34-9745-rtm-2020.04.05-linux-arm_eabi-32bit.tar.gz && rm softether-vpnserver-v4.34-9745-rtm-2020.04.05-linux-arm_eabi-32bit.tar.gz | |
cd vpnserver && sudo make | |
cd .. | |
sudo mv vpnserver /usr/local && cd /usr/local/vpnserver/ | |
sudo chmod 600 * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float map(float value, float min1, float max1, float min2, float max2) { | |
return min2 + (value - min1) * (max2 - min2) / (max1 - min1); | |
} |
NewerOlder