Skip to content

Instantly share code, notes, and snippets.

// Copyright © 2022 Xpl0itR
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
using System;
using System.Buffers;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Runtime.InteropServices;
using System.Threading;
static CancellationToken CreateSigIntTermToken(bool cancelDefaultHandler = true)
{
CancellationTokenSource cts = new();
void Handler(PosixSignalContext context)
{
context.Cancel = cancelDefaultHandler;
@Xpl0itR
Xpl0itR / gdownload.sh
Created March 9, 2022 01:19
A little script to download a file from Google Drive by file ID from the terminal
if [ "$1" == "" ]; then
echo "usage: gdownload.sh FILE_ID [OUT_DIR_PATH]"
exit 1
fi
FILE_ID="$1"
BASE_PATH=${2:-./}
COOKIE_PATH=$(mktemp)
CONFIRM_PAGE=$(wget --quiet --save-cookies $COOKIE_PATH --keep-session-cookies --no-check-certificate "https://drive.google.com/uc?export=download&id=$FILE_ID" -O-)
case "$CONFIRM_PAGE" in *"<title>Google Drive - Quota exceeded</title>"*)
echo "Quota Exceeded"
@Xpl0itR
Xpl0itR / EulerMeth.md
Last active October 13, 2020 20:46
Some code I wrote to automate Euler's Method for Differential Equations.

Automate Euler's Method for Differential Equations with Python

Python Version Support

This program was tested to work on both CPython v3.7.0 and MicroPython v1.9.4

How to use

This program is really simple to use. You will be prompted to enter the number of iterations you want to do, the initial known X-coordinate and Y-coordinate, the Differential equation in the form dy/dx= in terms of x and/or y and the value of h (the size of the steps you take on the x-axis after each iteration). After you enter the correct information, the program will generate a very ugly table of values you can use to plot your graph.