Skip to content

Instantly share code, notes, and snippets.

@wonbinbk
wonbinbk / gist:9d9ad8f99246d9ef7ee56553cb9950cf
Created December 4, 2024 23:03
Cherry pick from a commit but only for part of the changes and retain the commit messages, author, etc...
# Reference: https://stackoverflow.com/a/29788254
# The other methods didn't work for me since the commit had a lot of changes and conflicts to a lot of other files. What I came up with was simply
git show SHA -- file1.txt file2.txt | git apply -
# It doesn't actually add the files or do a commit for you so you may need to follow it up with
git add file1.txt file2.txt
git commit -c SHA
# Or if you want to skip the add you can use the --cached argument to git apply
@wonbinbk
wonbinbk / autorotation.sh
Last active March 18, 2023 18:29 — forked from Migacz85/autorotation.sh
Script to monitor iio-sensor-proxy output and rotate the Thinkpad X1 Yoga display/touch mask/stylus mask based on that info.
#!/bin/bash
monitor-sensor --accel | while read line
orientation="normal"
rotate="none"
do
if [[ $line =~ .*right.* ]]; then
orientation="right"
rotate="cw"
elif [[ $line =~ .*left.* ]]; then
@wonbinbk
wonbinbk / tmux-cheatsheet.markdown
Created April 9, 2022 14:30 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@wonbinbk
wonbinbk / Debugging LibreOffice - Create Table
Created February 18, 2021 10:11 — forked from jessoclarence/Debugging LibreOffice - Create Table
Understanding LibreOffice Source Code
Aim
To make sense of LibreOffice source code. I plan to put a breakpoint in the constructors of
SwTableBox, and then get the back trace to see the flow and gain a little understanding of what's
going on. This is post is aimed at beginners, so a little knowledge of C++/Java should be able to
get one through this.
[A Little Background Info (Skip this)
I'm a programmer from the Center for Development of Advanced Computing (CDAC), India, currently
@wonbinbk
wonbinbk / hidemo.c
Created January 30, 2020 01:10 — forked from chertov/hidemo.c
Demo hi3516cv200 h264 stream reading
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/poll.h>
#include <sys/time.h>
#include <fcntl.h>
#include <errno.h>
@wonbinbk
wonbinbk / beautiful_idiomatic_python.md
Created May 20, 2017 12:56 — forked from JeffPaine/beautiful_idiomatic_python.md
Transforming Code into Beautiful, Idiomatic Python: notes from Raymond Hettinger's talk at pycon US 2013. The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Transforming Code into Beautiful, Idiomatic Python

Notes from Raymond Hettinger's talk at pycon US 2013 video, slides.

The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Looping over a range of numbers

for i in [0, 1, 2, 3, 4, 5]: