Skip to content

Instantly share code, notes, and snippets.

@jachin
jachin / prompt.php
Created June 21, 2011 04:34
PHP Command Line Confirmation Prompt
$message = "Are you sure you want to do this [y/N]";
print $message;
flush();
ob_flush();
$confirmation = trim( fgets( STDIN ) );
if ( $confirmation !== 'y' ) {
// The user did not say 'y'.
exit (0);
}
@jachin
jachin / openeats-2-nextcloud-cookbook.py
Created February 15, 2024 03:02
OpenEats to Nextcloud Cookbook
import requests
import os
import json
import getpass
import datetime
from shutil import copyfileobj, make_archive
from urllib.parse import urljoin
from pathlib import Path
# Configuration
@jachin
jachin / Diff and Patch.rst
Last active December 14, 2022 05:52
diff and patch

First generate a patch for others to apply. For this we use diff where the first argument shall be the original file or directory where did you started making the modifications and the second should be a version of the file or directory with the modifications already made.:

diff -Naur old_file new_file > your_patch_filename.patch

or (if applied against directories):

diff -Naur old_dir new_dir > your_patch_filename.patch

The options on these diff commands are the following

@jachin
jachin / Recursively Delete Things.rst
Last active April 17, 2021 23:23
Recursively delete (some) files.

Recursively delete CVS directories:

find . -depth -name 'CVS' -exec rm -rf '{}' \; -print

Remove .svn directories from a git repository:

find . -depth -name '.svn' -exec git rm --cached -r '{}' \; -print

Remove .pyc files:

@jachin
jachin / youtube_rss.txt
Last active January 20, 2020 05:57
YouTube Cannel RSS Feed
https://www.youtube.com/feeds/videos.xml?channel_id=<channel-id>
@jachin
jachin / gist:b3385735e5b26d16c106e07ed636c048
Created April 17, 2018 18:21
Blockstack Verification
Verifying my Blockstack ID is secured with the address 18cVBwhNMBhcT66LTtLctAZLd5prBBwAUP https://explorer.blockstack.org/address/18cVBwhNMBhcT66LTtLctAZLd5prBBwAUP
@jachin
jachin / itunes-playlist-to-rst.py
Created December 12, 2017 20:50
This little script takes a XML iTunes playlist file and makes an reStructuredText list out of the playlist. There's more features to add, but this is a start.
#! /usr/bin/env python3
import argparse
import plistlib
if (__name__ == "__main__"):
parser = argparse.ArgumentParser()
parser.add_argument("playlist_file")
@jachin
jachin / atili.us-public-keys.txt
Last active September 4, 2017 06:56
An SSH Public Key I use Sometimes.
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDAvpSfWKT2DvcAV498bUkg/lk3P7T0zIoZEhDDUwwu/4ARV88A396XtsdzioQTSzguswJW5M3nEIhVcjIw6Z872AZWFugTtR95+DsFIUcnm3bEJWD5mfreBJuyhA171E1kYMqdTReR/a/1iDGjzdYY4OqSYrC3QDomrjIHLX8zSRhwsftm2XtuQxO5IywNKoSx/cPdGNXuHEviJJVskzb7zrF8fjLh1wqb7y7JgzUVG8AiqlVa5FFXFncdgb4tMith2dcdWBR/Ne2crZxhDeq1AgSU4exgeEoVpPNw2LmXvFws2mMs4/OWPXXZvjugprHIlW9O3JgzxSS1+77IVb8y2bQDf92GB9zqglNSZUPKyLBg9cpQljdF0rEQcBjCacQ1t8Xq14zI5TqXsQDesYRHEWyOP60geFQ+25a+tjy8+gu5bNQbRf5qClSFfQHN7Vw10CGrhlw+qroIn++fq6/Zs8j1b1G14P8SDqIB3cPdAHedRc/KJMrw3pty2b5LVpYeJxcrZT7SPRnPuaohJUqFJC454Xt2Dqv+pUxc7H08k0ry8PJb4AUiWplHybJPVyJyipIxlKjT9aE9Jrz4gQfzbn8vMq+JOtlKv8W66JRxJFQUdg3RP5BTjR61iBn6si6w8IAwJFyCC8RjaIUHQBhC2/2ovJ+zu5cBGBfbIP2GwQ== jachin@Jachins-Fifth-Limb.local
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCwrsBg2dtd/tLIGWfjZXwpOWWYmq8fC2l6AQW1h7jVuDIoNGix0N1f840M7qcHeLsdJ3hsGOO4mEFj/CAkhbSfZzT9NQpaxYgdpoBvqFP40WBvlh6u/rLwvbvhGjf1BXP/v0uiPgvs8YEN5I9D2W6Da1v2+xms0GznakNiQP1quyqTgA8jY1cFdX6qpZjR3gGFj73MQQ1fuyr/i9cA/0HypIsROCIfv8oyw0L
@jachin
jachin / gist:60eed5feff70000764f212747a97e9a5
Created September 27, 2016 01:16
saltstack rsync error
----------
ID: /usr/share/nginx/floyds.barberwindow.com/meteor-app
Function: rsync.synchronized
Result: False
Comment: An exception occurred in this state: Traceback (most recent call last):
File "/var/tmp/.jachin_b4dd4e_salt/py2/salt/state.py", line 1733, in call
**cdata['kwargs'])
File "/var/tmp/.jachin_b4dd4e_salt/py2/salt/loader.py", line 1652, in wrapper
return f(*args, **kwargs)
File "/var/tmp/.jachin_b4dd4e_salt/py2/salt/states/rsync.py", line 112, in synchronized
Verifying that +jachin is my blockchain ID. https://onename.com/jachin