Skip to content

Instantly share code, notes, and snippets.

View patdavid's full-sized avatar

Pat David patdavid

View GitHub Profile
@patdavid
patdavid / XSLT Identity Transform
Created May 4, 2018 18:50
Identity Transform and targeting an XPath node
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
@patdavid
patdavid / Bash_command_line_shortcuts.md
Created January 24, 2018 16:03 — forked from P7h/Bash_command_line_shortcuts.md
Bash command line Shortcuts

Bash command line Shortcuts

Picked these from here

Command Editing Shortcuts

Command Note
Ctrl + a go to the start of the command line
Ctrl + e go to the end of the command line
Ctrl + k delete from cursor to the end of the command line
@patdavid
patdavid / gmic-video-avg
Created January 10, 2018 18:45
G'MIC Video Avg Command
avg_video :
-e[] "" -v - n=0 go=1
-do
-l[] -i "$1",$n,$n -if $! n+=1 -else go=0 -endif -onfail go=0 -endl
-+
-v + -e[] "\r - Image "$n" " -v -
-while $go -/ $n -v +
avg_files :
-e[] "" -v - files=${"-files \"$1\""} -arg2var _file,$files n=0 go=1
@patdavid
patdavid / transmission-remote-move-folder
Last active January 16, 2018 19:58
transmission-remote move file location
# Get a list of all of the torrent files matching `grep`, and output to a (temp) text file:
transmission-remote -l | grep "Good" > list.txt
Loop through all lines in the text file, capture first column into $value1, move it!
while IFS=" " read -r value1 remainder;do transmission-remote -t $value1 --move /home/pat/Downloads/seeding/;done < list.txt

Keybase proof

I hereby claim:

  • I am patdavid on github.
  • I am patdavid (https://keybase.io/patdavid) on keybase.
  • I have a public key whose fingerprint is 66D1 7CA6 8088 4874 946D 18BD 67C7 6219 89E9 57AC

To claim this, I am signing this object:

@patdavid
patdavid / gitlog
Created October 22, 2017 14:30
pretty git log
# From http://stackoverflow.com/questions/1838873/visualizing-branch-topology-in-git/34467298#34467298
lg = !"git lg1"
lg1 = !"git lg1-specific --all"
lg2 = !"git lg2-specific --all"
lg3 = !"git lg3-specific --all"
lg1-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(auto)%d%C(reset)'
lg2-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(auto)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)'
lg3-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset) %C(bold cyan)(committed: %cD)%C(reset) %C(auto)%d%C(reset)%n'' %C(white)%s%C(reset)%n'' %C(dim white)- %an <%ae> %C(reset) %C(dim white)(committer: %cn <%ce>)%C(reset)'
function! ImgAttr()
" echo @"
" "normal "kyi'
" let tmp = @"
" let p = expand("%:p:h")
" let fullp = p .'/'. tmp
" "echo fullp
" let theWH=substitute(system('magick identify -format %wx%h "'.fullp.'"'),'\n','','')
" "let theData=substitute(theWH,'\([0-9]*\)x\([0-9]*\)', ' width="\1" height="\2" ','')
" let @y=substitute(theWH,'\([0-9]*\)x\([0-9]*\)', 'width="\1" height="\2" ','')
@patdavid
patdavid / HTML_insert.vim
Created April 6, 2017 14:34 — forked from groenewege/HTML_insert.vim
vim - insert html
" Version 1.2
" Script create :IMG command, whitch insert HTML IMG tag
" with fill atributes width and height.
"
" It's need _identify_ utility from ImageMagic!
"
" (c) Petr Mach <gsl@seznam.cz>, 2003
" http://iglu.cz/wraith/
"
" Call it without parameter for file browser for selecting image.
@patdavid
patdavid / scrape-digikam.py
Created March 21, 2017 22:15
Scraping the digikam website for news content to migrate to a new system
#!/usr/bin/python
from __future__ import unicode_literals
from selenium import webdriver
from selenium.webdriver.common.by import By
import time
import datetime
import os
import re
import sys

A test google link and some simple formatting.

A fenced code block, with language set to C++ ( ```C++):

#include "MIDIUSB.h"

#define ENCODER_PIN_A A3
#define ENCODER_PIN_B A2
#define NUMBER_CLICKS 30 // the number of clicks per rotation of the encoder