Skip to content

Instantly share code, notes, and snippets.

@SunRed
SunRed / unstuck.lua
Created April 14, 2015 20:43
A simple unstuck script in gmod
-- TODO: Nocollided props still trigger even with MASK_PLAYERSOLID!
---------------------------------------------------------------
local ply = nil
-- WeHateGarbage
local t = {start=nil,endpos=nil,mask=MASK_PLAYERSOLID,filter=nil}
local function PlayerNotStuck()
t.start = ply:GetPos()
t.endpos = t.start
@SunRed
SunRed / gdrive-download-tool.sh
Created January 28, 2016 14:00
This script easily downloads public files from Google Drive onto your disk using a file identifier.
#!/bin/bash
###########
# Download public files from Google Drive using file identifier
if [ $# -lt 1 ]; then
echo "No argument defined. Usage: $0 fileID [destination]" >&2
echo "Try '$0 --help' for more information."
exit 1
elif [ $# -gt 2 ]; then
echo "Too many arguments. Usage: $0 fileID [destination]" >&2
@SunRed
SunRed / fancyconnect.lua
Last active February 23, 2016 02:21
Small gmod script to make [dis-]connect messages a bit prettier.
-- Create shared ConVar
CreateConVar( "sv_connectsound", "1", FCVAR_REPLICATED )
-- Sound used for [dis-]connect events
CreateConVar( "sv_connectsoundfile", "buttons/combine_button3.wav", FCVAR_REPLICATED )
if SERVER then
util.AddNetworkString("FancyConnect.NetworkString")
hook.Add("PlayerConnect", "FancyConnect.ConnectMessage", function(name)
@SunRed
SunRed / userChrome.css
Last active June 14, 2018 19:00 — forked from Spaenny/userContent.css
Making Firefox Quantum dark
/*
Author: SpennyTF
Contributor: SunRed
How to install:
Just put the file under
%appdata%/Mozilla/Firefox/Profiles/<YOURPROFILE>/chrome/userChrome.css
You might have to create the chrome folder.
*/
@SunRed
SunRed / channels.js
Last active September 11, 2019 05:36
Poorly written lurk bot for Twitch in node
var channels = {};
channels.required = [
// Channels you will always lurk in (as long as the list is smaller than config.maxChannels)
];
channels.pool = [
// Channels of which you randomly lurk in whenever the channels get rerolled (config.rerollCronjob)
// These are used to fill the pool of channels up to the config.maxChannels value in case channels.required doesn't reach that value in size
];

Keybase proof

I hereby claim:

  • I am sunred on github.
  • I am sunred (https://keybase.io/sunred) on keybase.
  • I have a public key ASAjfKZEoC-AK8gqyJpBbfMlaDuzNiOWwemQ1wtzECZ_Zgo

To claim this, I am signing this object:

@SunRed
SunRed / motd.sh
Created October 20, 2020 07:30
Fancy login MOTD for the Raspberry Pi that can be placed in /etc/profile.d
#!/bin/bash
clear
function color (){
echo "\e[$1m$2\e[0m"
}
function extend (){
local str="$1"
@SunRed
SunRed / nextcloud.conf
Last active November 30, 2020 11:09 — forked from fennb/gist:1283573
nginx microcaching config example for a Nextcloud instance behind a proxy (E.g. Nextcloud on Raspberry Pi tunnelled through WireGuard to a public server)
# Set cache dir
proxy_cache_path /var/cache/nginx levels=1:2
keys_zone=microcache:5m max_size=1000m;
# Virtualhost/server configuration
server {
listen 443;
listen [::]:443;
server_name yourhost.domain.com;
@SunRed
SunRed / mirror.sh
Created March 23, 2021 15:03
Simple script utilizing rsync to sync two directories.
#!/bin/bash
set -e
read -e -p "Source Directory [./]: " SOURCE
SOURCE=${SOURCE:-./}
read -e -p "Destination Directory [../Mirror]: " DEST
DEST=${DEST:-../Mirror}
if [ $# -eq 0 ] || [ -z $1 ]
@SunRed
SunRed / particles.js
Last active July 4, 2022 20:05
Draw connected particles onto a canvas
const c = document.getElementById("particles");
const ctx = c.getContext("2d");
const maxParticles = 100 * (1/Math.pow(window.devicePixelRatio, .75));
const size = 2;
const r = size/2;
const cft = 1000/60;
let previous, stepratio;
let w, h, d;
resize();