Skip to content

Instantly share code, notes, and snippets.

@jimathyp
jimathyp / .gitignore
Last active October 19, 2016 02:48 — forked from octocat/.gitignore
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# ignore notepadplusplus backup files
@jimathyp
jimathyp / rsa.py
Created October 19, 2016 03:11 — forked from tylerl/rsa.py
RSA Explained in Python
#!/usr/bin/env python
# This example demonstrates RSA public-key cryptography in an
# easy-to-follow manner. It works on integers alone, and uses much smaller numbers
# for the sake of clarity.
#####################################################################
# First we pick our primes. These will determine our keys.
#####################################################################
@jimathyp
jimathyp / aws-hotstrings.ahk
Last active July 1, 2020 20:47
[Autohotkey] #autohotkey
;==============================================================================
; AWS EC2 instance data
;==============================================================================
::curl-meta-data::
(
curl -w "\n" http://169.254.169.254/latest/meta-data/
)
@jimathyp
jimathyp / ps_mem.py
Created April 2, 2019 01:15
System Admin
# https://raw.githubusercontent.com/pixelb/ps_mem/master/ps_mem.py
#!/usr/bin/env python
# Try to determine how much RAM is currently being used per program.
# Note per _program_, not per process. So for example this script
# will report RAM used by all httpd process together. In detail it reports:
# sum(private RAM for program processes) + sum(Shared RAM for program processes)
# The shared RAM is problematic to calculate, and this script automatically
# selects the most accurate method available for your kernel.

Error message when attempting to ssh to a server

user@host: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

Check /var/log/secure

Authentication refused: bad ownership or modes for file /home/user/.ssh/authorized_keys

Check permissions on ~/.ssh/authorized_keys and ~/.ssh

SQL usage

(SQL flavours, Spark, Athena Presto, Postgres)

To get column type

Depends on the RDBMs

DNS lookups in WSL

/etc/resolv.conf

Git differences and patches

To create a diff file

git diff the_file > the_file.diff
@jimathyp
jimathyp / wsl.md
Last active June 19, 2021 01:10
WSL usage

WSL

eg in powershell

PS > wslconfig.exe /? Performs administrative operations on Windows Subsystem for Linux

Usage: /l, /list [/all] Lists registered distributions.