Skip to content

Instantly share code, notes, and snippets.

View 2KAbhishek's full-sized avatar
🤩
Fixing Tpyos!

Abhishek Keshri 2KAbhishek

🤩
Fixing Tpyos!
View GitHub Profile
@2KAbhishek
2KAbhishek / Blank.md
Last active January 1, 2020 23:41
target="_blank" vulnerability

Example attack scenario

Create a fake "viral" page with cute cat pictures, jokes or whatever, get it shared on Facebook (which is known for opening links via _blank). Create a "phishing" website at https://fakewebsite/facebook.com/page.html for example Put this code on your "viral" page window.opener.location = 'https://fakewebsite/facebook.com/page.html'; which redirects the Facebook tab to your phishing page, asking the user to re-enter her Facebook password.

How to fix

Add this to your outgoing links.

@2KAbhishek
2KAbhishek / error_report.js
Last active January 1, 2020 22:57
Minimalist version of sentry
window.onerror = function(msg, _path, line, column, error) {
fetch('/errors', {
error: error ? error.stack : '',
column: column,
line: line,
msg: msg
})
return false
}
@2KAbhishek
2KAbhishek / prefers-mode.css
Created October 12, 2019 13:10
CSS dark theme depending upon device settings.
@media (prefers-color-scheme: dark) {
body {
background-color: #444;
color: #e4e4e4;
}
a {
color: #e39777;
}
img {
filter: grayscale(30%);
@2KAbhishek
2KAbhishek / clone_less.md
Created August 25, 2019 07:02
Only clone most recent version of git repo.

Clones only the most recent history.

git clone --depth 1 'repo-remote'
@2KAbhishek
2KAbhishek / designMode.js
Created August 23, 2019 08:59
Edit web pages for testing.
// Open web console and run
// Turn design mode on
document.designMode = 'on';
// Turn off after done testing
document.designMode = 'off';
@2KAbhishek
2KAbhishek / displaymode.sh
Created August 9, 2019 10:11
Add unsupported display resolution.
# Run cvt with required resolution
cvt 1360 768 60
# Copy the ModeLine section of output and use with xrandr
xrandr --newmode "1360x768_60.00" 84.75 1360 1432 1568 1776 768 771 781 798 -hsync +vsync
# Add the output mode
xrandr --addmode VGA1 1360x768_60.00
# Set the output mode & add this line to a startup script
@2KAbhishek
2KAbhishek / Podcasts.opml.xml
Last active August 29, 2019 16:02
My Podcast Subscriptions
<?xml version="1.0" encoding="UTF-8"?>
<opml version="2.0">
<head>
<title>Podcast Subscriptions</title>
</head>
<body>
<outline text="CodeNewbie" title="CodeNewbie" type="rss" htmlUrl="http://feeds.codenewbie.org/cnpodcast.xml" xmlUrl="http://feeds.codenewbie.org/cnpodcast.xml" />
<outline text="Puliyabaazi Hindi Podcast" title="Puliyabaazi Hindi Podcast" type="rss" htmlUrl="http://puliyabaazi.ivm.libsynpro.com/rss" xmlUrl="http://puliyabaazi.ivm.libsynpro.com/rss" />
<outline text="The Passion People Podcast" title="The Passion People Podcast" type="rss" htmlUrl="https://audioboom.com/channels/4903093.rss" xmlUrl="https://audioboom.com/channels/4903093.rss" />
<outline text="Belong Accelerate" title="Belong Accelerate" type="rss" htmlUrl="http://feeds.soundcloud.com/users/soundcloud:users:399018450/sounds.rss" xmlUrl="http://feeds.soundcloud.com/users/soundcloud:users:399018450/sounds.rss" />
@2KAbhishek
2KAbhishek / remove_dup.sh
Created August 6, 2019 03:45
Remove duplicate lines from file
#Remove duplicate lines
awk '!visited[$0]++' old_file > new_file
@2KAbhishek
2KAbhishek / replace_name.sh
Created August 6, 2019 03:44
Replace Certain Part of filename
#Replace Certain Part of filename
for filename in ./*; do mv "./$filename" "./$(echo "$filename" | sed -e 's/old/new/g')"; done
@2KAbhishek
2KAbhishek / diff_patch.sh
Created August 6, 2019 03:40
Diff & Patch
diff -u v1.txt v2.txt > diff.patch
patch -p1 v1.txt < diff.patch