This file contains 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
// Importing the "axios" and "fs" modules | |
const axios = require('axios'); | |
const fs = require('fs'); | |
// Creating an instance of Axios with a "Bearer" token for authorization | |
const client = axios.create({ | |
headers: { | |
Authorization: `Bearer ${fs.readFileSync('apikey.txt', 'utf-8').trim()}` | |
} | |
}); |
This file contains 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
// Use in chrome console | |
function RenderBinary() { | |
const zeroChar = '🟢'; | |
const oneChar = '🟠'; | |
let frameNum = 0; | |
let pos = 0; | |
let timeStr = ''; | |
let date = new Date(); | |
let hours = date.getHours(); |
This file contains 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
youtube-dl --external-downloader aria2c --external-downloader-args "-x 16 -j 16 -c --max-file-not-found=10 --max-tries=20 --retry-wait=20" --format "bestvideo+bestaudio[ext=m4a]/bestvideo+bestaudio/best" --merge-output-format mp4 -a URL_LIST.txt -i --download-archive ~/existing.txt -o '%(epoch)s-%(title)s.%(ext)s' |
This file contains 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
// Run once in the console per page session | |
const NewWindow = window.open("NEW_LIST"); | |
// Run each time to scrape URLS - they will be added to the window opened during the first run | |
// Replace foo.bar/baz with your filter | |
var x = document.querySelectorAll("a"), u = "foo.bar/baz", a = []; | |
for (let i = 0; i < x.length; i++) a.push([x[i].textContent.replace(/\s+/g, ' ').trim(), x[i].href]); | |
function g(f) { | |
let t = ''; | |
for (let i = 0; i < a.length; i++) if (a[i][1].includes(f)) t += a[i][1] + '\n'; |
This file contains 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
const flat = (array, res) => { | |
// Short circuit the result if empty | |
if (array.length < 1 || !(array instanceof Array)) return res; | |
// Set start item | |
let s = array[0]; | |
// Set remaining items | |
let r = array.slice(1); | |
This file contains 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
# Automated AMI and Snapshot Deletion | |
# | |
# @author Robert Kozora <[email protected]> | |
# | |
# This script will search for all instances having a tag with "Backup" or "backup" | |
# on it. As soon as we have the instances list, we loop through each instance | |
# and reference the AMIs of that instance. We check that the latest daily backup | |
# succeeded then we store every image that's reached its DeleteOn tag's date for | |
# deletion. We then loop through the AMIs, deregister them and remove all the | |
# snapshots associated with that AMI. |
This file contains 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
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Collections.ObjectModel; | |
// This is based on the graph implementation found at: https://msdn.microsoft.com/en-us/library/ms379574(v=vs.80).aspx | |
// But is updated to work in the latest C# and Net Core | |
namespace Graph1 | |
{ | |
class Program |
This file contains 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
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
namespace Trees1 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ |
This file contains 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
using System; | |
namespace PermMissingElem | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
int[] A = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 18 }; | |
var S = new Solution(); |
This file contains 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
using System; | |
namespace CyclicRotation | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var S = new Solution(); | |
var A = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 }; |
NewerOlder