Skip to content

Instantly share code, notes, and snippets.

@jfeilbach
jfeilbach / fa.sh
Last active July 14, 2020 17:59
Update all AWS tokens.
#!/bin/bash
# Update AWS tokens in all profiles
# Credentials File
creds="/home/${USER}/.aws/credentials"
# AWS username
fed=${FED_USERNAME}
# Convert UTC to local time
tz=$(timedatectl | grep "Time zone" | awk '{ print $4 " " $5 }')
# Get a list of profiles
@jfeilbach
jfeilbach / gist:724cbaba6367449ba36eda8f3f74496c
Created March 2, 2020 16:26
Generate ed25519 ssh host key
sudo ssh-keygen -f /etc/ssh/ssh_host_ed25519_key -N '' -t ed25519
@jfeilbach
jfeilbach / awscli.gpg.pub
Last active February 11, 2020 18:51
The AWS CLI v2 GPG public key
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBF2Cr7UBEADJZHcgusOJl7ENSyumXh85z0TRV0xJorM2B/JL0kHOyigQluUG
ZMLhENaG0bYatdrKP+3H91lvK050pXwnO/R7fB/FSTouki4ciIx5OuLlnJZIxSzx
PqGl0mkxImLNbGWoi6Lto0LYxqHN2iQtzlwTVmq9733zd3XfcXrZ3+LblHAgEt5G
TfNxEKJ8soPLyWmwDH6HWCnjZ/aIQRBTIQ05uVeEoYxSh6wOai7ss/KveoSNBbYz
gbdzoqI2Y8cgH2nbfgp3DSasaLZEdCSsIsK1u05CinE7k2qZ7KgKAUIcT/cR/grk
C6VwsnDU0OUCideXcQ8WeHutqvgZH1JgKDbznoIzeQHJD238GEu+eKhRHcz8/jeG
94zkcgJOz3KbZGYMiTh277Fvj9zzvZsbMBCedV1BTg3TqgvdX4bdkhf5cH+7NtWO
lrFj6UwAsGukBTAOxC0l/dnSmZhJ7Z1KmEWilro/gOrjtOxqRQutlIqG22TaqoPG
@jfeilbach
jfeilbach / setup.md
Last active May 18, 2020 17:05
Setup Ubuntu 20.04/19.10 steps

Steps to recover Ubuntu Dev desktop

Install OS

  • Create user

Login

  • Add online accounts as needed
  • Google
  • Ubuntu One
@jfeilbach
jfeilbach / start-cicso.sh
Created January 29, 2020 13:29
bash script to start cisco anyconnect vpn client via cli and use 2fa
#!/bin/bash
STTY=$(stty -g)
stty -echo
echo -e "connect <vpn server>/<path>\n<vpn user>"
/usr/bin/security find-generic-password -wl vpnpass.extadmin
oathtool --totp -b "$(/usr/bin/security find-generic-password -wl oathkey.extadmin)"
echo -e "y\n"
#stty "${STTY}"
@jfeilbach
jfeilbach / start-cisco.applescript
Created January 29, 2020 13:24
Automated Cisco VPN connect using guitar and 2FA
-- Create a new generic password entry in Keychain Access called {vpnKeychainEntry} (the name in Keychain access must match that in line 10 below) with your password for the Cisco AnyConnect VPN server.
-- e.g., /usr/bin/security add-generic-password -a joey -s vpnpass -l 'vpnpass.extadmin' -w`
-- Create another one for the oath token (use the same label as found on line 13); enter the OATH tool token identifier twice
-- e.g., /usr/bin/security add-generic-password -a joey -s vpnpass -l 'oathkey.extadmin' -w`
-- Open this script in Script Editor (both this and the above are in the Applications->Utilities folder) and "Save as.." an Application (.app) with desired name.
-- Open Security & Privacy System Preferences, go to Privacy, Accessibility.
-- Enable the above .app so it can access Accessibility
-- Copy and paste a nice icon on the generic Applescript icon (I used a copy of the default AnyConnect one)
-- Add the new .app to ${HOME}/Applications with a shortcut to your Dock
-- Enjoy the fast conn
@jfeilbach
jfeilbach / scutil.in
Created January 29, 2020 13:23
cisco any connect replace name server post auth
open
get State:/Network/Service/com.cisco.anyconnect/DNS
d.remove ServerAddresses
d.add ServerAddresses * 172.30.1.2
set State:/Network/Service/com.cisco.anyconnect/DNS
quit
@jfeilbach
jfeilbach / gist:6b56a5a6f98d2971aca12690bec8a64d
Last active December 2, 2019 18:58
Enable Natural Scolling or Reversing mouse scroll inside an Ubuntu VM on a Windows host with both OS natural scroll enabled

Natural Scrolling

I avoid Windows at all cost however someone in need asked for help on this topic. Changing to Natural Scroll in Windows for a mouse is a royal pain in the ass. It is trivial to fix for a track pad but not for a the scroll wheel of a mouse. You must do things the Mircosoft way. If you have a Linux VM on top of Windows fixing this can ve confusing.

Windows

  • On a Windows 10 host to reverse the mouse scroll direction from stupid Windows default to "natural" scroll direction. Natural scroll simply means you are scrolling the content instead of the view. Find your mouse hardware ID. In this case it is for a Razer mamba Wireless mouse.
  • Find hardware ID in Windows;
    • Go to the Mouse control panel advanced page, then
    • Hardware
    • Details
    • Hardware IDs
@jfeilbach
jfeilbach / fips_140-2.md
Last active April 22, 2021 00:59
Disable FIPS; Enable FIPS

Enable FIPS Mode

FIPS stands for “Federal Information Processing Standards.” It’s a set of government standards that define how certain things are used in the government–for example, encryption algorithms. FIPS defines certain specific encryption methods that can be used, as well as methods for generating encryption keys. It’s published by the National Institute of Standards and Technology, or NIST. FIPS mode is stupid.

yum install dracut-fips

For CPUs with the AES New Instructions (AES-NI) support, install the dracut-fips-aesni package as well:

yum install dracut-fips-aesni

@jfeilbach
jfeilbach / squid.conf
Last active November 14, 2019 17:08
improve squid logging
logformat squid %tl %6tr %>a %Ss/%03Hs %<st %rm %ru %un %Sh/%<A %mt
```
Time related format codes:
ts Seconds since epoch
tu subsecond time (milliseconds)
tl Local time. Optional strftime format argument
default %d/%b/%Y:%H:%M:%S %z
tg GMT time. Optional strftime format argument