Skip to content

Instantly share code, notes, and snippets.

@Rav4s
Rav4s / dontclosechrome.html
Created October 21, 2021 22:40
ok so sometimes i accidentally click the x on my chrome window and it closes all my tabs which is just ughhh so this file will just show a js alert preventing you from closing the window without confirmation
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script>window.onbeforeunload = function() { return "You're closing all the tabs!"; }</script>
</head>
<body>
@Rav4s
Rav4s / centered_comments.css
Created July 23, 2021 21:07
Center comments in ghost footer
<style>
.container {
width: 100%;
text-align: center;
align-items: center;
position: absolute;
}
.comments {
width: 50%;
@Rav4s
Rav4s / OutstandingScoutsChecker.gs
Last active March 19, 2021 22:18
Add some more meeting data to process and assign a score. Multiply by 420 to make all the scores seem higher than they actually are.
function main()
{
for (var i = 5; i <= 86; i = i + 1) {
var col = 3;
var val1 = SpreadsheetApp.getActiveSheet().getRange(i, col).getValue();
console.log(val1);
var col = 4;
var val2 = SpreadsheetApp.getActiveSheet().getRange(i, col).getValue();
console.log(val2);
var col = 5;
@Rav4s
Rav4s / auto_reboot.sh
Created January 16, 2021 21:09
Automatically reboots a Raspberry Pi when it loses connection with another server.
#!/bin/bash
SUB='commento'
while true
do
VALUE=`curl 192.168.0.230`
if [[ "$VALUE" == *"$SUB"* ]]
then
echo "Connected to server."
@Rav4s
Rav4s / rockpaperscissors.java
Last active November 20, 2020 14:50
Two bots randomly choose rock, paper, or scissors. Their results are compared to see who will win. The result is in the form of a list as such: [BotOne result, BotTwo result, Who wins?]
import java.util.concurrent.ThreadLocalRandom;
import java.util.*;
public class RockPaperScissors {
static int rockPaperScissors() {
int randomNum = ThreadLocalRandom.current().nextInt(1, 4);
if (randomNum == 1) {
//System.out.println("Rock");
return randomNum;
}