Skip to content

Instantly share code, notes, and snippets.

View karlding's full-sized avatar
🤔

Karl Ding karlding

🤔
View GitHub Profile
@karlding
karlding / testj1939.py
Created April 25, 2020 09:45
A partial re-implementation of testj1939 from can-utils in Python to test bpo-40291
"""A partial re-implementation of testj1939 from can-utils in Python to test
https://github.com/python/cpython/pull/19538
"""
import socket
def main():
with socket.socket(
family=socket.PF_CAN, type=socket.SOCK_DGRAM, proto=socket.CAN_J1939
) as s:
@karlding
karlding / find-modified-files-by-pr.sh
Created May 21, 2019 07:58
get a list of all files modified by the given PRs
#!/bin/bash
ACTIVE_PRS=(290 539 554 567)
DIFF_FILE="output.txt"
echo "" >| "${DIFF_FILE}"
for PR in "${ACTIVE_PRS[@]}"; do
git fetch origin pull/"${PR}"/head:pr-"${PR}"
git diff --name-only develop...pr-"${PR}" | tee -a "${DIFF_FILE}"
@karlding
karlding / cygwin-symlinks.md
Created March 24, 2018 04:39
making cygwin use native symlinks

Keybase proof

I hereby claim:

  • I am karlding on github.
  • I am karlding (https://keybase.io/karlding) on keybase.
  • I have a public key ASDjk5bahFgKFcF7XNRR3loS6sakwJv0X0WE1ljuJSzefQo

To claim this, I am signing this object:

Trackpad Two Finger Scrolling Workaround After Suspend

After suspending, two finger scrolling stops working.

 → TITANIC@~ $ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 17.10
Release:	17.10
#!/bin/bash
# Backup all my music from my Windows Music folder
# (/media/karl/5A14316614314673/Users/Karl/Music) to my 2 TB external drive
# (/media/karl/A0D83FDAD83FAE02/bak/Users/Karl/Music) using rsync
WINDOWS_MEDIA_DIR="/media/karl/5A14316614314673/Users/Karl/Music"
EXTERNAL_DRIVE="/media/karl/A0D83FDAD83FAE02/bak/Users/Karl"
rsync -va "${WINDOWS_MEDIA_DIR}" "${EXTERNAL_DRIVE}"
@karlding
karlding / downloading-vagrant-boxes-manually.md
Created January 14, 2018 05:45
how to download vagrant boxes manually

Download Vagrant boxes manually

In this example, we're going to download the Midnight Sun box.

# The box URL is https://app.vagrantup.com/uwmidsun/boxes/box/versions/2.1.0
# In general, we just take the box URL, and then append the provider URL
# https://app.vagrantup.com/<organization name>/boxes/<box name>/versions/<version>/providers/<provider>.box
wget https://app.vagrantup.com/uwmidsun/boxes/box/versions/2.1.0/providers/virtualbox.box -O box-2.1.0.box
#!/bin/bash
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $HOME/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
TMUX_VERSION=2.5
@karlding
karlding / pyenv+virtualenv cheat sheet.md
Last active June 2, 2020 03:45
pyenv and virtualenv cheat sheet
@karlding
karlding / camera-raw.md
Created August 16, 2017 03:32
Deleting the JPG previews while keeping the DNGs

On my Nexus 5, I started shooting in RAW mode with JPG previews. However, when I copy the DNGs over to my laptop for editing/archival, I don't care about the JPG files.

The camera app creates two files:

  1. filename.jpg: the JPG preview
  2. filename.dng: the RAW file

Basically, we want to remove any JPG files for which a RAW file also exists. I