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 / gist:5439013
Created April 22, 2013 22:10
Crontab template
View gist:5439013
MAILTO=""
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * command to be executed
# * * * * * command --arg1 --arg2 file1 file2 2>&1
@ozh
ozh / new empty git branch.md
Last active November 27, 2023 11:57
Create a new empty branch in Git
View new empty git branch.md
$ 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 / dalle.md
Last active October 17, 2023 15:14
DALL-E prompts inspiration and examples #dalle #dalle2
View dalle.md

Prompts

@ozh
ozh / gist:4131243
Created November 22, 2012 13:44
Create dot files/directories (ie .file) on Windows
View gist:4131243

#How to create a .file or .folder on Windows

There are several ways

1. Rename

  • Create file.txt
  • Rename to .file., the last dot will be dropped, you'll have .file

Works the same with a file or a directory.

@ozh
ozh / git cherry-pick within a pull request.md
Last active August 16, 2023 02:32
git cherry-pick within a pull request
View git cherry-pick within a pull request.md

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 / markdown_image_border.md
Created May 14, 2020 16:30
Image border in markdown
View markdown_image_border.md

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 / composer-proxy.md
Created March 24, 2014 23:30
Using Composer behind a proxy
View composer-proxy.md

Define the proxy in the CLI :

$ export https_proxy='87.248.188.202:8080'
$ export http_proxy='87.248.188.202:8080'

Check proxy :

@ozh
ozh / current_result.md
Created March 11, 2022 18:39
Future unit tests for `yourls_is_shorturl()`
View current_result.md

As of writing and with YOURLS 1.8.3-dev, expectedly works with http(s)://sho.rt/ozh but fail with http(s)://www.sho.rt/ozh (and logically if YOURLS_SITE has www. (eg http://www.sho.rt) the failures and success get inverted)

$ phpunit --filter ShortURL_Is_Shorturl_Tests
YOURLS installed, starting PHPUnit

PHPUnit 8.5.14 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.0.1 with Xdebug 3.0.2
Configuration: D:\home\planetozh\ozh.in\phpunit.xml
@ozh
ozh / omgtorrent.cz.md
Last active May 21, 2023 12:57
Torrent hash to magnet link bookmarklet
View omgtorrent.cz.md

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 / YOURLS_locales.md
Created April 2, 2022 20:36
YOURLS_LANG in the wild
View YOURLS_locales.md

Here are the values of YOURLS_LANG people use in their YOURLS config.php (real life data fetch on April 2022)

Locale
af_ZA
ar
ar-SA
ar_AR
ar_EG