Skip to content

Instantly share code, notes, and snippets.

@OrionReed
OrionReed / dom3d.js
Last active April 19, 2024 19:48
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
/*
* Copyright (c) 1987, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
@danielwetan
danielwetan / nodejs-cicd-github-actions.md
Last active April 19, 2024 19:46
Deploy Node.js to VPS using Github Actions

Deploy Node.js to VPS using Github Actions

Steps to deploy Node.js to VPS using PM2 and Github Actions

1. Clone repo to VPS folder

@imhoffd
imhoffd / ci.yml
Last active April 19, 2024 19:46
Parallelizing Jest in GitHub Actions
name: CI
on: [push]
jobs:
setup:
runs-on: ubuntu-latest
outputs:
test-chunks: ${{ steps['set-test-chunks'].outputs['test-chunks'] }}
test-chunk-ids: ${{ steps['set-test-chunk-ids'].outputs['test-chunk-ids'] }}
steps:
- uses: actions/checkout@v2
@hakerdefo
hakerdefo / sources.list
Last active April 19, 2024 19:41
Ubuntu 22.04 LTS (Jammy Jellyfish) complete sources.list
deb http://archive.ubuntu.com/ubuntu/ jammy main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ jammy main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse
@roommen
roommen / OpenSSH Update Script - Amazon Linux 2
Last active April 19, 2024 19:41
OpenSSH Update Script - Amazon Linux 2
#!/bin/bash
sudo yum install gcc -y
sudo yum install openssl-devel -y
sudo yum install zlib-devel -y
sudo yum install mlocate -y
sudo yum install autoconf -y
wget https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.1p1.tar.gz
tar zxvf openssh-9.1p1.tar.gz
cd openssh-9.1p1 && ./configure && make && sudo make install
@vfontjr
vfontjr / user_role_add-remove.php
Last active April 19, 2024 19:41
Masterminds user role add/remove
<?php
/**
* masterminds_update_user_roles function.
*
* This is the main callback function for the
* frm_after_create_entry and frm_after_update_entry actions
* It's purpose is to process Developers Directory registrations
* and grant various WordPress roles based on user responses
*
* @access public
@enjalot
enjalot / index.html
Created September 8, 2011 15:15
Simple Pie Chart example with D3.js
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Testing Pie Chart</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?2.1.3"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.geom.js?2.1.3"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.layout.js?2.1.3"></script>
<style type="text/css">
@maxux
maxux / humanread.c
Last active April 19, 2024 19:34
Human readable size to bytes in C
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <errno.h>
#include <string.h>
static char *human_readable_suffix = "kMGT";
size_t *parse_human_readable(char *input, size_t *target) {
char *endp = input;
@zer0k-z
zer0k-z / rampbugfix.md
Created April 3, 2024 23:27
CS2KZ's rampbug fix

Introduction

In CS2, when a player is sliding/surfing against some geometry, it's possible that they lose all their momentum/velocity. This is usually called wallbug/rampbug. While the name was inherited from Source 1 games (such as CS:GO, CS:S, TF2,...), rampbugs in CS2 behave much differently from its predecessor. In contrast to source 1 games, it's also possible have the velocity redirected to another direction instead of losing all momentum.

This bug doesn't seem to be common in all source 2 games (HL:A for instance, does not have this bug), and was orignially not present in the very early versions of CS2 Limited Test. Rampbugs become more and more frequent over time, with the Call to Arms update effectively doubling the frequency of these bugs, which is a significant problem for custom gamemodes heavily depending on geometry collision (eg. surf).

Keep in mind that while the player collision hitbox is a box, the images shown below will represent the player as a dot instead for simplicity.

Observati