Skip to content

Instantly share code, notes, and snippets.

@arnu515
arnu515 / .zshrc
Last active August 16, 2020 10:40
# arnu515's .zshrc aliases. NOT FULL .zshrc FILE!
# ALIASES
# Make directory and cd into it. Usage: mc <dirname>
mc () {
mkdir $1 && cd $1
}
alias ..="cd .."
alias l="ls -al"
@arnu515
arnu515 / security.py
Created December 16, 2020 13:21
Security.py file I use in my projects (Mostly for my reference)
from cryptography.fernet import Fernet
import bcrypt
import os
# THESE KEYS ARE VISIBLE KEYS AND ARE NOT INTENDED FOR PRODUCTION
# SEPARATE KEYS MUST BE DECLARED FOR PRODUCTION
# THESE KEYS ARE ONLY INTENDED FOR DEVELOPMENT
f1 = Fernet(os.getenv("FERNET_KEY_1", "XF6OymR9AUpgZE9j_O3H7oY_9EwrEvCs7O2sYQmyskk=").encode())
f2 = Fernet(os.getenv("FERNET_KEY_2", "HovvX4QOJd-cpGKGPmqqY3EH0AGbw1gfHmQM2LpIrRo=").encode())
f3 = Fernet(os.getenv("FERNET_KEY_3", "WziTQwFIoHbqAU8KvY7Lc5wIRfE6LfjdaW3Lm7pnc0U=").encode())
@arnu515
arnu515 / App.svelte
Created January 17, 2021 15:22
Basic routing using PageJS in svelte
<script lang="ts">
import page from "page";
import { setContext } from "svelte";
import { parse } from "qs";
import Index from "./routes/index.svelte";
export let apiUrl: string;
setContext<string>("apiUrl", apiUrl);
let component: any, query: any, params: any;
@arnu515
arnu515 / App.svelte
Last active April 30, 2021 04:23
Dev.to Implement Passwordless sign-in to your apps
<script lang="ts">
import Auth from "./lib/components/Auth.svelte";
import Code from "./lib/components/Code.svelte";
let sentLink = false;
let token = localStorage.getItem("token");
async function getUser() {
if (!token) return;
try {
@arnu515
arnu515 / .eslintrc.cjs
Created June 14, 2021 14:00
.eslintrc.cjs and .prettierrc
module.exports = {
root: true,
extends: ["eslint:recommended", "prettier"],
ignorePatterns: ["*.cjs"],
rules: {},
env: {
es2017: true,
node: true
}
};
@arnu515
arnu515 / SortArray.java
Created June 21, 2021 09:37
Bubble, selection and insertion sort implemented in java
import java.util.Scanner;
import java.util.Random;
public class SortArray {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.out.println("1. Bubble sort\n2. Selection sort\n3. Insertion sort\n");
System.out.println("Enter integer:");
int choice = s.nextInt();

DigitalOcean Domains Dynamic DNS

Automatically updates a domain (registered with DigitalOcean)'s record with the current IP of the machine. Ideal for home-labs with dynamic IPs who want to avoid services like NoIP or can't use cloudflare domains.

Designed for Linux

How to use

Requires: Python 3.6.9 or later, requests library installed.

@arnu515
arnu515 / countries.csv
Last active October 30, 2022 04:21
Countries with Calling Code - CSV and JSON
name calling_code alpha2 alpha3
Afghanistan 93 AF AFG
Albania 355 AL ALB
Algeria 213 DZ DZA
American Samoa 1-684 AS ASM
Andorra 376 AD AND
Angola 244 AO AGO
Anguilla 1-264 AI AIA
Antarctica 672 AQ ATA
Antigua and Barbuda 1-268 AG ATG
@arnu515
arnu515 / README.md
Created November 3, 2022 01:06
Extensions to mimetypes and mimetypes to extensions json files

If you want to regenerate this file, you can use this REPL. Just run the repl and it will create a file called mimetypes_to_extensions.json and extensions_to_mimetypes.json.

The data for this is provided by Apache. Leave a comment if it is outdated, and I'll update it.

@arnu515
arnu515 / README.md
Last active July 3, 2023 17:05
Countries with 2letter and 3letter iso 3166 codes with emojis and flag url