Skip to content

Instantly share code, notes, and snippets.

View kapitanluffy's full-sized avatar
🏠
Working from home

kapitanluffy

🏠
Working from home
View GitHub Profile
@kapitanluffy
kapitanluffy / autorefreshRudderstack.js
Created September 15, 2023 01:47
Auto refreshes rudderstack live events every 5s
(function autorefreshRudderstack() {
document.querySelector('button[name="Pause"]').setAttribute('id', 'button--refresh')
setInterval(() => {
document.querySelector('#button--refresh').click()
document.querySelector('#button--refresh').click()
}, 5000)
})();
@kapitanluffy
kapitanluffy / moving-median.js
Created December 13, 2022 14:58
I have no idea what a moving median is...
// So I had trouble with Coderbyte's "Moving Median". I have no idea what a "moving median" or a "sliding window" is.
// I can't understand the problem and googling it unfortunately didn't help me at that moment. Maybe I panicked?
// So I burned the remaining 1h50m of a 2 hour test and as I opened a new tab and searched 'moving median "javascript"'
// and I stumbled upon this: https://www.tutorialspoint.com/finding-median-for-every-window-in-javascript
//
// Median turns out was simply the number in the middle of the specified "sliding window".
// I guess I should've listened to my Math professor back in highschool jeez
//
// Below is my take on this problem
{
"debug": true,
"delay": 0.5,
"linters": {
// basically, this is just what you need in enabling a linter
"php": {
"disable": false
},
"phpcs": {
"args": [
set -g prefix C-space
# Use Alt-arrow keys without prefix key to switch panes
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tpm'
@kapitanluffy
kapitanluffy / compiler.php
Created November 12, 2019 13:45
Compiles classes into a single giant package file
<?php
/**
* Compiles all files into one giant package file
*
* Usage php compiler.php path/directory/PackageFoo
*
* We assume that your package is under a package folder. This will be used as the package file name
* e.g. path/directory/PackageFoo/
*
@kapitanluffy
kapitanluffy / mount.bat
Created April 22, 2019 20:56
Mount directory to specified drive letter with fallback to achieve ubiquity across networks
@echo off
:: Mount directory to specified drive letter with fallback to achieve ubiquity across networks
:: Checks existence of host by the following order
:: - Check host in LAN
:: - Check host in Remote
:: - Check host in Local
:: Since Windows does not have native support for sftp/ssh we use sshfs (FUSE) instead
@kapitanluffy
kapitanluffy / gamifyApi.js
Created March 18, 2019 15:32
amazon.com/hz/gamification/api/contributor/dashboard
function gamifyApi() {
window.location.href = "https://www.amazon.com/hz/gamification/api/contributor/dashboard/"
+ window.CustomerProfileRootProps.directedId
+ "?ownerView=false"
+ "&customerFollowEnabled=false"
+ "&token=" + window.CustomerProfileRootProps.contributorDashboardData.token
}
@kapitanluffy
kapitanluffy / install-docker-ubuntu.sh
Created January 25, 2019 11:02
Convenience script for installing docker in Ubuntu
#!/bin/bash
# Convenience script for installing docker in Ubuntu
#
# https://docs.docker.com/install/linux/docker-ce/ubuntu/#install-using-the-repository
# https://docs.docker.com/install/linux/linux-postinstall/
apt-get update
apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
@kapitanluffy
kapitanluffy / isEven.php
Last active December 13, 2018 10:35
isEven
<?php
function isEven($num) {
return ($num % 2 == 0);
}

Screen Quick Reference

Basic

Description Command
Start a new session with session name screen -S <session_name>
List running sessions / screens screen -ls
Attach to a running session screen -x
Attach to a running session with name screen -r <session_name>