curiouser / cakeThief.js
0 mi piace
0 forks
1 files
Ultima volta attivo 2 months ago
A solution to this code challenge: https://www.interviewcake.com/question/javascript/cake-thief
| 1 | class Bag { |
| 2 | constructor (capacity) { |
| 3 | this.capacity = capacity; |
| 4 | this.cakes = []; |
| 5 | this.weight = 0; |
| 6 | this.value = 0; |
| 7 | } |
| 8 | |
| 9 | addCake (cake) { |
| 10 | this.cakes.push(cake); |
curiouser / nys-vehicle-inspection.js
0 mi piace
0 forks
1 files
Ultima volta attivo 2 months ago
A web console script for searching over all NYS Vehicle Inspection search results
| 1 | // This script is intended to be run from a web console. It must be run from the correct webpage. |
| 2 | // Step 1: Fill out this and search https://process.dmv.ny.gov/FacilityLookup/ |
| 3 | // Step 2: Select your vehicle type, etc until you receive results |
| 4 | // Step 3: Edit the countResults variable below to the actual number |
| 5 | // Step 4: Inject jQuery into the webpage by copying the commented code below into the web console |
| 6 | // var jq = document.createElement('script');jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js";document.getElementsByTagName('head')[0].appendChild(jq); |
| 7 | |
| 8 | // Step 5: Copy and paste the below into your web console and run it. When the searching is finished, you should receive an array of matches logged to console. |
| 9 | |
| 10 | // modify this value to be the total # of results |
curiouser / color-graduation.js
0 mi piace
0 forks
1 files
Ultima volta attivo 2 months ago
An update to the first solution here: https://gist.github.com/jayzawrotny/3079b17004a5237910a58f877bac1d58f
| 1 | // Vanilla solution |
| 2 | let format = require('util').format; |
| 3 | |
| 4 | const COLORS = [ |
| 5 | { stop: 0, rgb: [35, 198, 161] }, |
| 6 | { stop: 6, rgb: [245, 235, 73] }, |
| 7 | { stop: 48, rgb: [245, 51, 0] }, |
| 8 | ]; |
| 9 | |
| 10 | function getRGBColor (hours) { |
curiouser / netflix-random.js
0 mi piace
0 forks
1 files
Ultima volta attivo 2 months ago
This script will select a random movie from your Netflix list and play it
| 1 | // Navigate to your "My List" page before running this in your web console |
| 2 | |
| 3 | // Get a list of all titles |
| 4 | var movies = document.querySelectorAll(".slider-item"); |
| 5 | |
| 6 | // pick a random number between 0 and length |
| 7 | var random = Math.floor(Math.random() * movies.length); |
| 8 | |
| 9 | // this is our movie |
| 10 | var movie = movies[random]; |
curiouser / git-rename-ts-files.js
0 mi piace
0 forks
1 files
Ultima volta attivo 2 months ago
Node script for renaming files with .ts or .tsx file extensions to .js or .jsx
| 1 | const glob = require("glob"); |
| 2 | const { execSync } = require('child_process'); |
| 3 | |
| 4 | console.log('building list of files'); |
| 5 | |
| 6 | const opts = { absolute: true }; |
| 7 | var files = glob.sync("**/*.ts", opts).concat(glob.sync("**/*.tsx", opts)).filter(f => f.indexOf('node_modules') < 0); |
| 8 | |
| 9 | console.log(`found ${files.length} files`); |
curiouser / arm64-bionic-zfs
0 mi piace
0 forks
1 files
Ultima volta attivo 2 months ago
Configuration for a fresh Ubuntu 18.04 Rock64 install. Adds a user, sets timezone, installs zfs, samba, configures disk power management, etc
| 1 | #!/bin/bash |
| 2 | |
| 3 | # |
| 4 | # Read this script and modify it before running. It's not tested as is and is not |
| 5 | # meant to be run unsupervised. |
| 6 | # |
| 7 | |
| 8 | hostname='YOUR_DESIRED_HOSTNAME' |
| 9 | user='YOUR_USERNAME' |
| 10 | hdd_spindown_timeout=1800 |
curiouser / gist:68415b0f411f495e90e10774b33305ec
0 mi piace
0 forks
2 files
Ultima volta attivo 2 months ago
galp5-benchmarks.md
Context
- I received my first galp5 (iGPU) about 30 days ago; replacement galp5 (dGPU) arrived yesterday (defective thunderbolt port on first)
- I don't use my laptop as a daily driver as I'm working from home and I have a desktop workstation (HP Z840)
- Been a Linux desktop (Pop!_OS) user for about 100 days, migrated from macOS (10.5 - 10.14), have lightly managed linux servers for ~10 years
- Previous laptops:
- 2007 15" MBP
- 2011 15" MBP
- 2010 17" MBP
- 2011 17" MBP
- 2014 15" rMBP dGPU
curiouser / suspend-then-hibernate.sh
0 mi piace
0 forks
1 files
Ultima volta attivo 2 months ago
Pop!_OS 20.10 galp5 Suspend then hibernate
| 1 | #!/bin/bash |
| 2 | ### FROM BOOT DISK |
| 3 | # remove cryptswap entry |
| 4 | vi /etc/crypttab |
| 5 | |
| 6 | # remove swap from fstab |
| 7 | vi /etc/fstab |
| 8 | |
| 9 | # reboot into firmware, select one time boot and choose USB live installer |
| 10 | systemctl reboot --firmware |
curiouser / dockify.sh
0 mi piace
0 forks
2 files
Ultima volta attivo 2 months ago
Profiles for running System76 Galago Pro (galp5) docked vs undocked
| 1 | #!/bin/bash |
| 2 | |
| 3 | echo 'restoring text-scaling to 133%' |
| 4 | gsettings set org.gnome.desktop.interface text-scaling-factor 1.33 |
| 5 | |
| 6 | echo 'restoring auto suspend on AC power' |
| 7 | gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type 'suspend' |
| 8 | |
| 9 | echo 're-enabling suspend-then-hibernate' |
| 10 | test -h /etc/systemd/system/systemd-suspend.service || sudo ln -s /usr/lib/systemd/system/systemd-suspend-then-hibernate.service /etc/systemd/system/systemd-suspend.service |
Più nuovi
Più vecchi