Skip to content

Instantly share code, notes, and snippets.

@cowlinator
cowlinator / gain_and_bias.txt
Created July 8, 2023 02:51
gain_and_bias.txt
gain == weight == amplitude == strength
bias == phase == offset == shift
@cowlinator
cowlinator / paramiko_hello_world.py
Last active March 12, 2022 01:00
Paramiko SFTP Hello World
import paramiko
def get(host, user, passw, remote_path, local_path, public_host_key_filepath=None):
with paramiko.SSHClient() as ssh:
if public_host_key_filepath:
# secure
ssh.load_host_keys(public_host_key_filepath)
ssh.set_missing_host_key_policy(paramiko.RejectPolicy())
else:
# not secure
@cowlinator
cowlinator / pathlib_interface.txt
Created February 12, 2020 02:49
pathlib_interface.txt
class _Flavour(object):
"""A flavour implements a particular (platform-specific) set of path
semantics."""
def __init__(self)
def parse_parts(self, parts)
def join_parsed_parts(self, drv, root, parts, drv2, root2, parts2)
"""
Join the two paths represented by the respective
(drive, root, parts) tuples. Return a new (drive, root, parts) tuple.
"""
@cowlinator
cowlinator / patch_paramiko.py
Last active May 23, 2019 17:02
Patch paramiko to remove cryptography warnings ( https://github.com/paramiko/paramiko/issues/1369 )
import distutils.version
import os
import subprocess
import sys
import paramiko
import requests
if __name__ == "__main__":
print(paramiko.__version__)
@cowlinator
cowlinator / docker msbuild fix
Created March 13, 2019 01:34
How to fix msbuild LNK1318 in Docker containers without modifying the project files
Create a file with the following contents:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Fix for error LNK1318 in hyperV docker containers -->
<ItemDefinitionGroup>
<ClCompile>
<DebugInformationFormat>OldStyle</DebugInformationFormat>
</ClCompile>
</ItemDefinitionGroup>
( >&2 pause ) >> yourfile.txt
@cowlinator
cowlinator / git_commands.txt
Last active October 3, 2017 01:36
Useful git commands
git checkout -- . DISCARD non-staged changes
git clean -d -f DISCARD untracked files
git cherry-pick --no-commit $SHA Cherry-pick to staging area
git revert --no-commit $SHA Revert to staging area
git push -f FORCE push
git reset --hard @{u} RESET HARD to upstream-branch
git branch --unset-upstream Track Remote: None (for current branch)
git branch --set-upstream-to=$REMOTE_BRANCH Track Remote (for current branch)