Skip to content

Instantly share code, notes, and snippets.

View cuschk's full-sized avatar
💻
Writing code

cuschk

💻
Writing code
View GitHub Profile
@cuschk
cuschk / get-cookie-names.js
Created January 16, 2020 13:02
Get cookie names
@cuschk
cuschk / remove-scripts.js
Created April 25, 2018 17:46
Remove all scripts from a web page
document.querySelectorAll('script').forEach(el => { el.parentNode.removeChild(el); });
@cuschk
cuschk / remove-styles.js
Last active April 25, 2018 18:26
Remove all styles from a web page
document.querySelectorAll('style, link[rel="stylesheet"]').forEach(el => { el.parentNode.removeChild(el); });
document.querySelectorAll('[style]').forEach(el => { el.removeAttribute('style'); });
@cuschk
cuschk / keybase.md
Created July 2, 2017 09:48
My Keybase verification

Keybase proof

I hereby claim:

  • I am uschek on github.
  • I am uschek (https://keybase.io/uschek) on keybase.
  • I have a public key ASBM12QZ6jKqJnzP4ef3uZBHEmMMcCB8C9fBDofdTEbqggo

To claim this, I am signing this object:

@cuschk
cuschk / filename.sh
Created July 8, 2016 11:30
Bash: file base name and extension
#!/usr/bin/env bash
f='/path/to/example.txt'
base="${f##*/}"
echo $base
#=> example.txt
echo "${base%.*}"
@cuschk
cuschk / filename.zsh
Last active July 15, 2022 05:47
Zsh: file base name and extension
#!/usr/bin/env zsh
f='example.txt'
echo ${f:r}
#=> example
echo ${f:e}
#=> txt
@cuschk
cuschk / index.html
Last active April 15, 2019 21:08
Basic HTML5 file with UTF-8 encoding
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title></title>
</head>
<body>
<p></p>
</body>
@cuschk
cuschk / .htaccess
Last active August 31, 2017 12:04
Redirect HTTP requests to non-www HTTPS
RewriteEngine On
RewriteBase /
# don't rewrite robots.txt
RewriteRule ^robots.txt$ - [L]
# redirect to non-www
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
@cuschk
cuschk / .htaccess
Last active November 8, 2017 13:54
Redirect HTTP requests to a certain domain using HTTPS
RewriteEngine On
RewriteBase /
# don't rewrite robots.txt
RewriteRule ^robots.txt$ - [L]
# redirect all requests to example.com with HTTPS
RewriteCond %{HTTP_HOST} !^example\.com$ [NC]
RewriteRule ^(.*)$ https://example.com/$1 [R=301,L]