Skip to content

Instantly share code, notes, and snippets.

View uuklanger's full-sized avatar

uuklanger

View GitHub Profile
@uuklanger
uuklanger / howto_generate_access_constants_case_with_bash.md
Last active November 15, 2019 06:24
HOWTO - Generate C# Accessors - Constants - Case From a Text file using Bash

Overview

In some cases, you need to create a bunch of repeating code based on some data you intended on processing. In the following examples, I had all the field names listed in a powershell script but I just needed to translate it to C#.

I pasted the data in needed onto a linux box into a file called t.txt. This is the general format of the file where this is just a small piece of the 50 or so fields this script was displaying.

Input File

~/tmp % head t.txt
@uuklanger
uuklanger / howto_setup_pylint_with_pycharm.md
Last active December 4, 2023 20:44
HOWTO - Setup pylint with PyCharm and the PyLint Plugin

Overivew

Setting up a linter can help detect odd or non-typical coding practices. The following will describe how to setup PyCharm for basic linting with the PyCharm PyLint plugin.

This assumes you have a venv setup within your current project.

Install Pylint

For pylint for your current project venv the following two commands should be run in your project root. The first will install pylint and the second will create an rc file which you can then adjust for your current project.

@uuklanger
uuklanger / howto_run_coverage_unittest_all.md
Last active November 12, 2019 21:11
HOWTO - Run Coverage for All Code with Unittests

Overview

Within most IDEs you can run "coverage" on your code which tells you how much of your unittests cover the code you have written. If you want to run this kind of coverage from the command line (terminal) for a Python project there are just a few simple steps to follow.

This can be tried directly by cloning this project and running the following.

Assumptions

  • Python 3.7+
  • macOS, linux, or even Windows 10 (WSL preferred).
@uuklanger
uuklanger / dos2unix_tr.md
Last active October 30, 2019 16:15
HOWTO - Convert DOS to UNIX format

Convert DOS file to UNIX Format

If you clone a repo to a windows system and want to run shell scripts like bash or zsh within the Windows Subsystem for Linux you might need to fix the end-of-line characters. This depends on if you preserve end-of-line characters based on what is in the repo or if you have your local repo auto manage that.

Use Translate to fix this

tr -d '\r' < a.txt > b.txt
@uuklanger
uuklanger / zsh_rc_profile.txt
Created October 17, 2019 22:32
Snippets for creating a ZSH Environment
# --------------- .zshrc ---------------
# Set up the prompt
autoload -Uz promptinit
promptinit
#prompt adam1
prompt adam1 blue
#prompt fade blue white green
@uuklanger
uuklanger / fake_await_call.snippet
Created October 3, 2019 15:42
HOWTO - Fake await Calls in async Testing Code to avoid Compiler Warnings for Methods that have Nothing awaitable
// Official Microsoft Way
await Task.CompletedTask;
// Alternate Way
await Task.Delay(0);
@uuklanger
uuklanger / MakeGitKrakenSSHKEY.sh
Last active January 21, 2022 18:13
HOWTO: Create a ssh RSA Key compatible with GITKRAKEN
$ ssh-keygen -t rsa -m PEM -b 4096 -C "mylogin@HOST"
OR the modern way
$ ssh-keygen -t ed25519 -C "your_email@example.com"
@uuklanger
uuklanger / event_log_40960.ps1
Created November 7, 2018 19:16
Query the Windows 10 Event Log for any instance id of 40960
Get-EventLog -LogName "System" -Newest 100 -InstanceId 40960
write-host "Press any key to continue..."
[void][System.Console]::ReadKey($true)
@uuklanger
uuklanger / cmdkey.exe
Created November 6, 2018 22:28
HOWTO: View Cached Passwords in Windows 10 using built in command
C:\Users\k.langer>cmdkey
Creates, displays, and deletes stored user names and passwords.
The syntax of this command is:
CMDKEY [{/add | /generic}:targetname {/smartcard | /user:username {/pass{:password}}} | /delete{:targetname | /ras} | /list{:targetname}]
Examples:
@uuklanger
uuklanger / google_calendar_sync
Created June 2, 2018 19:12
Google Calendar Sync
If you sync a calendar from a team or group and you want to sync it to google calendar do the following
1. From a browser go to google calenar and add the new calendar via URL (most likely)
2. Save and ensure you see some events from that team / group.
3. Now you want to see it on your iPhone/iPad
a. Go to https://calendar.google.com/calendar/syncselect
b. Check the calendar by name in the list you want to see on your mobile apps.
c. Save
4. Go to your phone or iPad and look at your calendar. You should see the new calendar populate within a few minutes.