A comprehensive reference guide comparing Go syntax to JavaScript, Python, and Rust, focusing on key concepts you'll encounter in this codebase.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Option 1: Using Python | |
| python -c "import secrets; print(secrets.token_urlsafe(32))" | |
| # Option 2: Using OpenSSL | |
| openssl rand -base64 32 | |
| # Option 3: Using Node.js | |
| node -e "console.log(require('crypto').randomBytes(32).toString('base64'))" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import csv | |
| import re | |
| import random | |
| from collections import defaultdict | |
| # ---------------- | |
| # 1. Loading Data | |
| # ---------------- | |
| def load_data(file_path): | |
| """ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Borrowed & modified from https://github.com/jenseng/abuse-the-platform/blob/main/app/utils/singleton.ts | |
| // Thanks @jenseng! | |
| export const singleton = <Value>( | |
| name: string, | |
| valueFactory: () => Value | |
| ): Value => { | |
| const g = global as any; | |
| g.__singletons ??= {}; | |
| g.__singletons[name] ??= valueFactory(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import type { ActionFunctionArgs } from "@remix-run/node"; // or cloudflare/deno | |
| export const action = async ({ | |
| request, | |
| }: ActionFunctionArgs) => { | |
| switch (request.method) { | |
| case "POST": { | |
| /* handle "POST" */ | |
| } | |
| case "PUT": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import csv | |
| import json | |
| import mailbox | |
| import os | |
| from datetime import datetime | |
| from email.header import decode_header | |
| from email.utils import parsedate_tz, mktime_tz | |
| import pandas as pd | |
| from bs4 import BeautifulSoup |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <JuceHeader.h> | |
| class LA2ACompressorAudioProcessor : public juce::AudioProcessor | |
| { | |
| public: | |
| LA2ACompressorAudioProcessor() | |
| { | |
| // Initialize parameters | |
| addParameter(inputGainParam = new juce::AudioParameterFloat("InputGain", "Input Gain", -24.0f, 24.0f, 0.0f)); | |
| addParameter(outputGainParam = new juce::AudioParameterFloat("OutputGain", "Output Gain", -24.0f, 24.0f, 0.0f)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from pydub import AudioSegment | |
| import os | |
| input_song = "./songs/Wade.aif" | |
| output_path = "./output" | |
| def convert_to_ogg_vorbis(src, out_path): | |
| # Load the audio file | |
| audio = AudioSegment.from_file(src) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // contracts/NFT.sol | |
| // SPDX-License-Identifier: MIT OR Apache-2.0 | |
| pragma solidity ^0.8.3; | |
| import "@openzeppelin/contracts/utils/Counters.sol"; | |
| import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; | |
| import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; | |
| import "hardhat/console.sol"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "apps": [ | |
| { | |
| /* General */ | |
| "name": "my-api", /* (string) application name (default to script filename without extension) */ | |
| "script": "index.js", /* (string) script path relative to pm2 start */ | |
| "cwd": "/var/www/", /* (string) the directory from which your app will be launched */ | |
| "args": "-a 13 -b 12", /* (string) string containing all arguments passed via CLI to script */ | |
| "interpreter": "/usr/bin/python", /* (string) interpreter absolute path (default to node) */ | |
| "interpreter_args": "--harmony", /* (string) option to pass to the interpreter */ |
NewerOlder