Skip to content

Instantly share code, notes, and snippets.

View avin's full-sized avatar
🚀

Avin Lambrero avin

🚀
View GitHub Profile
@avin
avin / coursehunter.tampermonkey.js
Created December 30, 2022 13:33
Coursehunter Separate Video Player
// ==UserScript==
// @name Coursehunter Separate Video Player
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://coursehunter.net/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// ==/UserScript==
@avin
avin / Front End Security Basics.md
Last active March 10, 2023 09:39
codebashing courses summary

Reverse Tabnabbing

If tag with target="_blank" or uses window.open the hacker can replace original tab with opener.location="https://www.evilsite.com"; by opened page. It can be used in a phishing attack To fix it add rel="noopener" to and 'noopener' as third argument for window.open(: window.open('https://www.your.url','_blank','noopener')

HTTP Strict-Transport-Security (HSTS)

Add header Strict-Transport-Security: max-age=31536000; includeSubdomains; preload to make sure that the user once accessed the HTTPS version of the page will always be automatically redirected to it bypassing requests for HTTP.

@avin
avin / man.txt
Last active October 9, 2022 12:15
solve-algorithm-guide
Original text from: https://seanprashad.com/leetcode-patterns/
----
If input array is sorted then
- Binary search
- Two pointers
If asked for all permutations/subsets then
- Backtracking
@avin
avin / clean.js
Created September 14, 2022 19:28
Keep solo element on page
const onPageReady = (fn) => {
if (document.readyState !== 'loading') {
fn();
} else {
document.addEventListener('DOMContentLoaded', fn);
}
};
onPageReady(() => {
const doClean = (el) => {
@avin
avin / expand-comments.js
Last active September 14, 2022 07:59
Auto expand jira comments
// ==UserScript==
// @name Auto expand jira comments
// @namespace http://tampermonkey.net/
// @version 0.1
// @author You
// @match https://rbs-develop.paymentgate.ru/*
// @grant none
// ==/UserScript==
(function() {
@avin
avin / sort-comments.js
Created September 12, 2022 16:27
JIRA Sort comments same way
// ==UserScript==
// @name Protect classic sort for JIRA comments
// @namespace http://tampermonkey.net/
// @version 0.1
// @author You
// @match https://rbs-develop.paymentgate.ru/*
// @grant none
// ==/UserScript==
(function() {
@avin
avin / script1.js
Last active August 28, 2022 16:51
express + webpack-dev-middleware + webpack-hot-middleware
// $/static/script.js
import './script2'
console.log('script1')
if (module.hot) {
module.hot.accept('./script2', function () {
console.log("YES")
});
@avin
avin / monitor-off-key.ahk
Created August 17, 2022 21:30
Win+F1 Switch off monitor
#SingleInstance, Force
SendMode Input
SetWorkingDir, %A_ScriptDir%
;---
; Win+F1 Switch off monitor
#F1::SendMessage,0x112,0xF170,2,,Program Manager
@avin
avin / client-config.json
Last active July 1, 2022 19:54
Shadowsocks quick setup
{
"server": "myserver.com",
"server_port": 10777,
"password": "ZMv5HNQ77SEkekvLJd8WYf8sRd4Z2",
"method": "chacha20-ietf-poly1305",
"local_address": "127.0.0.1",
"local_port": 15080
}
@avin
avin / foo.service
Created June 28, 2022 19:00
Systemd (systemctl) docker-compse based service
# File location: /etc/systemd/system
# Enable service to autostart: systemctl enable foo.service
[Unit]
Description=foo
Requires=docker.service
After=docker.service
[Service]
Restart=always