Skip to content

Instantly share code, notes, and snippets.

View ozh's full-sized avatar
🍷
More wine, please.

྅༻ Ǭɀħ ༄༆ཉ ozh

🍷
More wine, please.
View GitHub Profile
@ozh
ozh / git cherry-pick within a pull request.md
Last active April 21, 2024 01:31
git cherry-pick within a pull request

1. Create new branch:

git checkout -b otherrepo-master master

2. Get the contents of the PR

git pull https://github.com/otherrepo/my-repo-name.git master
@ozh
ozh / updatewp.md
Last active April 14, 2024 22:55
Bash script: update WordPress to latest

Works with Dreamhost's hosting style: directories in ~ like /home/joe/blog.joe.com/

@ozh
ozh / dalle.md
Last active April 10, 2024 18:12
DALL-E prompts inspiration and examples #dalle #dalle2

Prompts

@ozh
ozh / fix-t911.md
Last active March 30, 2024 15:16
Fix t911 links
  $('body').find('a').each(function() {
    var href=$(this).attr('onclick');
    if(href) {
      href=href.replace("location.href='", '').replace(/'$/g, '');
      $(this).attr('href',href);
    }

Bookmarklet with https://mrcoles.com/bookmarklet/ : (include jQuery)

@ozh
ozh / markdown_image_border.md
Created May 14, 2020 16:30
Image border in markdown

Image in markdown: no style possible

![alt-text](https://raw.githubusercontent.com/YOURLS/YOURLS/1.7.9/images/yourls-logo.png)

alt-text

IMG tag accepts no style

<img src="https://raw.githubusercontent.com/YOURLS/YOURLS/1.7.9/images/yourls-logo.png" border="1px solid red"/>

@ozh
ozh / omgtorrent.cz.md
Last active March 11, 2024 18:36
Torrent hash to magnet link bookmarklet

1) Bookmark this:

javascript:var magnetLink='magnet:?xt=urn:btih:'+document.getSelection();location.assign(magnetLink);

Highlight any torrent hash and click bookmarklet to generate and load magnet link

2) Bookmark this:

@ozh
ozh / remove-read-kobo.md
Last active March 10, 2024 11:39
Remove read books on kobo reader from the command line

Shell in the kobo, from the root :

sqlite3 -header .kobo/KoboReader.sqlite "SELECT ContentID FROM content WHERE BookTitle is null and ReadStatus = 2 ORDER BY Title;" | grep epub | sed 's!file:///mnt/onboard/!!' | while read f; do rm -f "$f"; done

@ozh
ozh / ozh.cfg
Last active March 8, 2024 18:42
Quakelive Config ozh.cfg #quake
// ************************
// * OZH QUAKELIVE CONFIG *
// ************************
unbindall
unaliasall
// *********
// * BINDS *
// *********
@ozh
ozh / new empty git branch.md
Last active March 3, 2024 13:42
Create a new empty branch in Git
$ git checkout --orphan NEWBRANCH
$ git rm -rf .

--orphan creates a new branch, but it starts without any commit. After running the above command you are on a new branch "NEWBRANCH", and the first commit you create from this state will start a new history without any ancestry.

You can then start adding files and commit them and they will live in their own branch. If you take a look at the log, you will see that it is isolated from the original log.

@ozh
ozh / gist:8812721
Created February 4, 2014 21:29
Adding ping() function to PDO
<?php
// http://terenceyim.wordpress.com/2009/01/09/adding-ping-function-to-pdo/
class NPDO {
private $pdo;
private $params;
public function __construct() {
$this->params = func_get_args();