Skip to content

Instantly share code, notes, and snippets.

@Nateowami
Nateowami / username_login_attempts.txt
Created December 26, 2019 05:02
Usernames that have attempted to log in to my server in the past 25 days
1234
123456
3knet
666666
aah
aakirti
ab
abdul
abraham
Account
@Nateowami
Nateowami / README.md
Last active June 1, 2018 21:07
Enabling Windows users to create symlinks

To allow Windows users to create symlinks:

  • Run secpol.msc. This (reportendly) does not exist on some versions of Windows and you will have to use a workaround.
  • Go to Local Policies -> User Rights Assignment -> Create symbolic links -> Add User or Group...
  • Type your username in the text field and click "Check Names".
  • Click OK, then click OK, and close the Local Security Policy window.

See the screenshot.

@Nateowami
Nateowami / ubuntu1604installer.sh
Created May 23, 2018 21:09
Modified xForge installer script
#!/bin/bash
set -eux
# add mongo's public key
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
if [ `whoami` == "root" ]
then
echo This script cannot be run as sudo!
@Nateowami
Nateowami / README.md
Last active December 18, 2017 05:12
Audio file

Just an audio file for testing.

@Nateowami
Nateowami / README.md
Created May 19, 2017 07:45
Using appcache

Application Cache notes

Major important things to remember when working with the app cache

https://html.spec.whatwg.org/#manifests

This feature is in the process of being removed from the Web platform. (This is a long process that takes many years.) Using any of the offline Web application features at this time is highly discouraged. Use service workers instead. [SW]


Contrary to one source, it appears the spec still requires the text/cache-manifest mime-type. Older browsers do as well, and its unclear which ones, so we should probably use it for the sake of the many devices running the older Android browsers.

@Nateowami
Nateowami / README.md
Created March 1, 2017 14:34
Failed username login attempts

See what usernames bots try to log into your server with

zgrep searches in zipped and unzipped files.

List unique usernames used in failed login attempts:

sudo zgrep -ohP "input_userauth_request: invalid user \K\w+" /var/log/auth.log* | sort -u
@Nateowami
Nateowami / divide_by_tiny_numbers.js
Created February 14, 2017 09:15
JavaScript tiny number divided by zero
``` javascript
0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001/0
Infinity
```
``` javascript
> 0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001/0
NaN
```
@Nateowami
Nateowami / README.md
Last active January 24, 2017 06:40
HTML5 boilerplate

Recommended (by me) HTML5 starter code

HTML doesn't actually require all of these tags, but it's good practice to include them, in my opinion. The following actually passes the W3C validator:

<!DOCTYPE html><title>T</title>

Feel free to suggest improvements. I'm thinking there may be some meta tags that should be added (e.g. a viewport one--something about mobile devices--can't remember).

@Nateowami
Nateowami / README.md
Last active December 28, 2016 08:46
Rename According to Image or Video Metadata

Bash one-liners to rename images or videos according to metadata (date or dimensions)

Pictures

jhead -nIMG_%Y%m%d_%H%M%S *.jpg

Short and simple, jhead takes a format string after the -n CLI flag. It only works with JPEGs though. On Ubuntu 16.04, install the jhead package.

Videos

@Nateowami
Nateowami / video-dimensions.js
Last active November 7, 2018 22:43
JS function to calculate the active are of an HTML5 video (i.e. the are of the element that is showing the video).
function videoDimensions(video) {
// Ratio of the video's intrisic dimensions
var videoRatio = video.videoWidth / video.videoHeight;
// The width and height of the video element
var width = video.offsetWidth, height = video.offsetHeight;
// The ratio of the element's width to its height
var elementRatio = width/height;
// If the video element is short and wide
if(elementRatio > videoRatio) width = height * videoRatio;
// It must be tall and thin, or exactly equal to the original ratio