Skip to content

Instantly share code, notes, and snippets.

View Angry-Russian's full-sized avatar
🏠
Working from home

Dmitri K. Angry-Russian

🏠
Working from home
View GitHub Profile
@Angry-Russian
Angry-Russian / facebookSort
Created October 12, 2013 14:40
snippet that sorts contacts by level of activity (active > mobile > offline)
var a = [],
l = document.getElementsByClassName('fbChatOrderedList')[0];
for(var i = 0; i < l.childElementCount; i++){
a.push(l.childNodes[i]);
}
a.sort(function(a, b){
if(a.classList.contains("active")){
return (b.classList.contains("active")?0:-1)
}else if(a.classList.contains("mobile")){
return (b.classList.contains("active")?1:
@Angry-Russian
Angry-Russian / Bender.cs
Created January 12, 2016 18:32
[Unity] A collection of classes used in an FPS game prototype
using UnityEngine;
using System.Collections;
public class Bender : MonoBehaviour {
public GameObject particles;
public float cooldown = 2f;
public GameObject explosion;
private float cooldownTimer = 0;
"
" sample vimrc file at
" https://amix.dk/vim/vimrc.html
"
"
"
"" source $MYVIMRC reloads the saved $MYVIMRC
nmap <Leader>s :source $MYVIMRC<CR>
" opens $MYVIMRC for editing, or use :tabedit $MYVIMRC
@Angry-Russian
Angry-Russian / README-setup-tunnel-as-systemd-service.md
Created November 27, 2022 20:36 — forked from drmalex07/README-setup-tunnel-as-systemd-service.md
Setup a secure (SSH) tunnel as a systemd service. #systemd #ssh #ssh-tunnel #ssh-forward

README

Create a template service file at /etc/systemd/system/secure-tunnel@.service. The template parameter will correspond to the name of target host:

[Unit]
Description=Setup a secure tunnel to %I
After=network.target
@Angry-Russian
Angry-Russian / Foundry-EX3 - First Movement of the Demiurge.js
Last active February 22, 2023 02:13
Example JS Macro for Exalted 3rd edition FoundryVTT plugin
let {results, roll, total} = rollResult;
let faceCount = results.filter(d => d.active && d.success).reduce((carry, d) => ({ ...carry, [d.result]: (carry[d.result] || 0) + 1 }), {})
let facesConsumed = this.facesConsumed || {};
let depth = this.depth || 0;
let faces = Array.from({length: 11-diceModifiers.targetNumber}, (v, k) => k+diceModifiers.targetNumber);
let failures = results.filter(d => d.active && !d.success).sort((a,b) => b.result - a.result);
let faceCheck = () => {
let result = faces.some(f => {