Skip to content

Instantly share code, notes, and snippets.

/* OpenSimplex Noise in C#
* Ported from https://gist.github.com/KdotJPG/b1270127455a94ac5d19
* and heavily refactored to improve performance. The main difference is that once the
* bit flags are determined, the result is pulled from a lookup table, saving the time
* used deciphering the bit flags again. */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
@digitalsanity
digitalsanity / gist:d5dfb4b2d6afa885a5d4edf82ce60d40
Created September 29, 2016 06:08 — forked from jstanden/gist:1489447
Simplex Noise in C# for Unity3D - Adapted from James Livingston's MinePackage: http://forum.unity3d.com/threads/minepackage-minecraft-starter-package.69573/
using UnityEngine;
using System.Collections;
public class SimplexNoiseGenerator {
private int[] A = new int[3];
private float s, u, v, w;
private int i, j, k;
private float onethird = 0.333333333f;
private float onesixth = 0.166666667f;
private int[] T;
FF Quantum arm/linux tweaks for performance/lightweight
- Also consider using Custom Theme and hiding the toolbar/title/statusbar to gain some additional screen space. My title bar is now the row of pinned tabs.
- Set in about:config
accessibility.force_disabled;1
accessibility.typeaheadfind.flashBar;0
browser.backspace_action;1
browser.cache.disk.capacity;358400
@digitalsanity
digitalsanity / gist:375d95ec5ad0673e10c50beb0e2c4e13
Created July 13, 2018 23:06
rock64 4GB RAM, packages installed on ayufan bionic 0.6.44
Listing...
abiword/bionic,now 3.0.2-6 arm64 [installed]
abiword-common/bionic,bionic,now 3.0.2-6 all [installed,automatic]
acl/bionic,now 2.2.52-3build1 arm64 [installed,automatic]
adapta-gtk-theme/now 3.93.1.22-0ubuntu1~bionic1 all [installed,upgradable to: 3.94.0.1-0ubuntu1~bionic1]
adduser/bionic,bionic,now 3.116ubuntu1 all [installed]
adwaita-icon-theme/bionic,bionic,now 3.28.0-1ubuntu1 all [installed,automatic]
aisleriot/bionic,now 1:3.22.5-1 arm64 [installed]
alsa-utils/bionic,now 1.1.3-1ubuntu1 arm64 [installed]
alsoft-conf/bionic,now 1.4.3-2 arm64 [installed]
@digitalsanity
digitalsanity / Linux_DRM_OpenGLES.c
Created July 14, 2018 05:32 — forked from Miouyouyou/Linux_DRM_OpenGLES.c
An example, inspired by Rob Clark "kmscube.c" that uses Linux Direct Rendering Manager ( DRM ) and EGL to create an OpenGL ES 2 context. This is a standalone example, that just clears the screen with a blueish color. Usable with Rockchip DRM drivers and Mali Wayland/DRM userspace drivers.
// gcc -o drmgl Linux_DRM_OpenGLES.c `pkg-config --cflags --libs libdrm` -lgbm -lEGL -lGLESv2
/*
* Copyright (c) 2012 Arvin Schnell <arvin.schnell@gmail.com>
* Copyright (c) 2012 Rob Clark <rob@ti.com>
* Copyright (c) 2017 Miouyouyou <Myy> <myy@miouyouyou.fr>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
Section "Monitor"
Identifier "Monitor0"
Modeline "3840x2160" 307.00 3840 4016 4104 4400 2160 2168 2178 2250 +hsync +vsync
EndSection
Section "Screen"
Identifier "Screen0"
Device "HDMI-0"
Option "ModeValidation" "AllowNon60hzmodesDFPModes, NoEDIDDFPMaxSizeCheck, NoVertRefreshCheck, NoHorizSyncCheck, NoDFPNativeResolutionCheck, NoMaxSizeCheck
, NoMaxPClkCheck, AllowNonEdidModes, NoEdidMaxPClkCheck"
Monitor "Monitor0"
gpio-keys {
> + compatible = "gpio-keys";
> + #address-cells = <1>;
> + #size-cells = <0>;
#address-cells and #size-cells aren't necessary here.
> + autorepeat;
> +
> + pinctrl-names = "default";
IPSET_BLACKLIST_NAME=blacklist # change it if it collides with a pre-existing ipset list
IPSET_TMP_BLACKLIST_NAME=${IPSET_BLACKLIST_NAME}-tmp
# ensure the directory for IP_BLACKLIST/IP_BLACKLIST_RESTORE exists (it won't be created automatically)
IP_BLACKLIST_RESTORE=/etc/ipset-blacklist/ip-blacklist.restore
IP_BLACKLIST=/etc/ipset-blacklist/ip-blacklist.list
VERBOSE=yes # probably set to "no" for cron jobs, default to yes
FORCE=yes # will create the ipset-iptable binding if it does not already exist
let IPTABLES_IPSET_RULE_NUMBER=1 # if FORCE is yes, the number at which place insert the ipset-match rule (default to 1)
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
13 2 * * * root /usr/local/sbin/update-blacklist.sh /etc/ipset-blacklist/ipset-blacklist.conf
#!/bin/bash
#
# usage update-blacklist.sh <configuration file>
# eg: update-blacklist.sh /etc/ipset-blacklist/ipset-blacklist.conf
#
if [[ -z "$1" ]]; then
echo "Error: please specify a configuration file, e.g. $0 /etc/ipset-blacklist/ipset-blacklist.conf"
exit 1
fi