Skip to content

Instantly share code, notes, and snippets.

View kus's full-sized avatar

Blake Kus kus

  • Google
  • Sydney, Australia
View GitHub Profile
@kus
kus / steam-cs-key-history.js
Last active April 10, 2024 17:29
Find out how much you have spent on Counter-Strike keys
// Open https://store.steampowered.com/account/history and make sure you are logged in to Steam.
// Scroll to the bottom and load all history.
// Open your browsers console (Ctrl + Shift + J on Chrome or Ctrl + Shift + K on Firefox)
// and paste all of this code (select all) in the text box (bottom) and hit enter
// If you get an error from the script you likely aren't running a modern browser
// you can paste the code here https://babeljs.io/repl and copy the output and run that.
(() => {
const HISTORY_URL = 'https://store.steampowered.com/account/history';
// English and Cyrillic alphabet
const CURRENCY_REGEXP = /([A-Za-z\u0400-\u04FF]+)?([^0-9]{1})?([0-9.]+)([A-Za-z€¥\$£\u0400-\u04FF\.]+)?/;
@kus
kus / fixIOSAudioContext.js
Last active March 27, 2024 11:21
Fix iOS AudioContext on Safari not playing any audio. It needs to be "warmed up" from a user interaction, then you can play audio with it as normal throughout the rest of the life cycle of the page.
// Fix iOS Audio Context by Blake Kus https://gist.github.com/kus/3f01d60569eeadefe3a1
// MIT license
(function() {
window.AudioContext = window.AudioContext || window.webkitAudioContext;
if (window.AudioContext) {
window.audioContext = new window.AudioContext();
}
var fixAudioContext = function (e) {
if (window.audioContext) {
// Create empty buffer
@kus
kus / autoexec.cfg
Last active March 26, 2024 04:50
Kus' CS2 autoexec.cfg with buy script, launch options, rates, grenade crosshair switcher etc
// Place in C:\Program Files (x86)\Steam\steamapps\common\Counter-Strike Global Offensive\game\csgo\cfg\autoexec.cfg
// To get your existing binds type "host_writeconfig" in console and find your config at C:\Program Files (x86)\Steam\userdata\<steamID3>\730\remote\cs2_user_keys.vcfg and cs2_user_convars.vcfg
// Launch options
// -noforcemaccel -noforcemparms -noforcemspd -novid -tickrate 128 -high -nojoy +exec autoexec
// Buy script
// Sets up numpad to buy the first 3 items from each tier across 1-9
bind "kp_1" "buy secondary1"
bind "kp_2" "buy secondary2"
@kus
kus / windows-setup.md
Last active February 14, 2024 11:48
Get a clean Windows up and running as a gaming and developer PC.

Install Chocolatey

Open Command Prompt as Administrator (right click > Run as administrator)

Paste into Command Prompt and hit enter:

@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"

When complete, install packages:

choco install -y chocolateygui dropbox googlechrome adobereader jre8 python2 7zip geforce-experience vlc ccleaner malwarebytes dropbox steam epicgameslauncher origin battle.net discord spotify slack whatsapp evernote beyondcompare handbrake sourcetree vscode nodejs yarn git mongodb ffmpeg imagemagick blender

@kus
kus / Aggregate-GPU-stats-on-Steam-Hardware-Survey.md
Last active January 9, 2024 01:22
Aggregate GPU stats on Steam Hardware Survey that meet minimum performance

Aggregate GPU stats on Steam Hardware Survey that meet a certain performance metric

There are two scripts, gpu-benchmark.js and steam.js both are written as self-invoking functions so you simply copy it from here and paste it in the console of the website and hit enter.

You only need to run gpu-benchmark.js if you want to get a fresh list of GPU's. The script has the NVIDIA 40 seriesm in it.

If you want to update the GPU's:

@kus
kus / osx-setup.md
Last active December 20, 2023 15:24
Get a clean Mac OSX up and running as a developer machine.

Make sure OS is up-to-date

Install Xcode:

(To get around certain build tools that actually require Xcode and not the cli tools)

From the App Store, open it once it's done then close it

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -license
@kus
kus / localhost-https.md
Last active October 21, 2023 01:54
Local HTTPS server, generate SSL certificate

Chrome has decided that what they deem powerful web platform features such as Geolocation, Device motion / orientation, getUserMedia etc can no longer run on "Insecure Origins", HTTP (non-HTTPS) being one of them. Read more

So if you want to use these features in development and you are testing on a mobile via the IP of your computer, you now need to be serving the content over HTTPS for it to work.

Generate local SSL certificate

First check if you need to install openssl with which openssl. If nothing comes up run brew install openssl to install openssl with Brew.

openssl genrsa -des3 -passout pass:x -out localhost.pass.key 2048
openssl rsa -passin pass:x -in localhost.pass.key -out localhost.key
@kus
kus / autoexec.cfg
Last active March 23, 2023 01:33
Kus CS:GO Config
// Place in C:\Program Files (x86)\Steam\steamapps\common\Counter-Strike Global Offensive\csgo\cfg\autoexec.cfg
// To get your existing binds find your config at C:\Program Files (x86)\Steam\userdata\<steamID3>\730\local\cfg\config.cfg
// Launch options
// https://steamcommunity.com/sharedfiles/filedetails/?id=379782151
// -noforcemaccel -noforcemparms -noforcemspd -novid -tickrate 128 -high -nojoy +exec autoexec
// Windows sensitivity: 6/11, enhance pointer precision: off
con_enable "1" // Enable console
@kus
kus / kodi-android-setup.txt
Created March 26, 2017 11:55
Kodi Android Setup
Connect to network
Open Kodi
Let it download updates (first time)
Select SYSTEM > File Manager > Add Source
Select <None> and enter "http://fusion.tvaddons.ag" (without quotes) and select Done
Highlight the box at the bottom and enter "Fusion" (without quotes) and select Done
Select OK
Go back to Kodi Home Screen
Select SYSTEM > Add-ons > Install from zip file > Fusion > kodi-repos > english
Scroll down and select repository.exodus-x.x.x.zip
@kus
kus / convert-video.sh
Last active March 16, 2022 20:50
Convert any video (i.e.: AVI, MOV, MP4) to MP4 or WEBM with FFmpeg. Has option to export MP4 with YUV planar color space so it works with QuickTime and Safari.
#!/bin/bash
# Version 1.0 2016-06-03 https://gist.github.com/kus/318f21b840df0b7a6377563ce717c184
# MIT license
# Prerequisites:
# Homebrew: http://brew.sh/
# Install FFmpeg via Homebrew: brew install ffmpeg --with-fdk-aac --with-ffplay --with-freetype --with-libass --with-libquvi --with-libvpx --with-theora --with-libogg --with-libvorbis --with-opus --with-x265
# Make the script executable: sudo chmod u+x convert-video.sh
# Run: ./convert-video.sh