Skip to content

Instantly share code, notes, and snippets.

View patillacode's full-sized avatar
🍕
I'm generally a very pragmatic person: that which works, works. - Linus Torvalds

Patilla Code patillacode

🍕
I'm generally a very pragmatic person: that which works, works. - Linus Torvalds
View GitHub Profile
@patillacode
patillacode / tweet.py
Last active December 6, 2015 03:25
Tweet returned by Twitter API (json encoded)
{ 'contributors': None,
'coordinates': None,
'created_at': 'Fri Dec 04 15:01:22 +0000 2015',
'entities': {'hashtags': [{'indices': [67, 78], 'text': 'javascript'},
{'indices': [79, 83], 'text': 'php'},
{'indices': [84, 91], 'text': 'python'},
{'indices': [92, 113], 'text': 'softwarearchitecture'}],
'symbols': [],
'urls': [{'display_url': 'goo.gl/fb/XGY31t',
'expanded_url': 'http://goo.gl/fb/XGY31t',
Verifying my Blockstack ID is secured with the address 1P4PPWpCPAngkuuazefTmer9cnvyQudhy7 https://explorer.blockstack.org/address/1P4PPWpCPAngkuuazefTmer9cnvyQudhy7
youtube-dl --playlist-reverse -o "%(playlist_index)s-%(title)s.%(ext)s"
@patillacode
patillacode / convert.sh
Created October 17, 2018 00:32
Small script convert wav to mp3
#!/bin/bash
for i in *.wav; do
ffmpeg -i "$i" -vn -ar 44100 -ac 2 -ab 320k -f mp3 "${i%%.*}.mp3"
done
@patillacode
patillacode / loading.py
Created April 23, 2019 10:53
Python loading bar
def print_status_bar(number, number_of_pages):
percentage = int((number / number_of_pages) * 100)
progress = int((percentage * 20) / 100)
progress_msg = '#' * progress + '.' * (20 - progress)
msg = f' Processing [{progress_msg}] ({number}/{number_of_pages})'
print(msg, end='\r', flush=True)
# Use
number_of_pages = Page.objects.count()
for number, page in enumerate(Page.objects.all()):

Keybase proof

I hereby claim:

  • I am patillacode on github.
  • I am patillacode (https://keybase.io/patillacode) on keybase.
  • I have a public key ASDc90pWfK4Dq76XRSxknUQ_E1Cgws8TMj8B8mXkvApBiAo

To claim this, I am signing this object:

@patillacode
patillacode / plex_updater.sh
Created November 17, 2019 22:25
Small bash script that updates your Plex Media Server (Linux) automatically - with a nice output for when running manually!
#!/bin/bash
tput setaf 1 && tput bold
echo "Stopping the Plex server"
sudo service plexmediaserver stop
tput sgr0 && tput setaf 4
echo "Moving to /tmp/ ..."
cd /tmp/
@patillacode
patillacode / feature on top of master
Created July 3, 2020 11:08
Reset your feature branch to the master state
# Switch to the master branch and make sure you are up to date.
git checkout master
git fetch # this may be necessary (depending on your git config) to receive updates on origin/master
git pull
# Merge the feature branch into the master branch.
git merge feature_branch
# Reset the master branch to origin's state.
git rebase -i -p 0ad14fa5
# editor will open, mark all the commits with "edit"/"e"
# walk through each commit
git commit --amend --author="John Doe <john@doe.org>" --no-edit
git rebase --continue
@patillacode
patillacode / Set new NGINX config
Created April 4, 2021 04:06
For when I forget the steps to set a new config in NGINX
sudo cp /etc/nginx/sites-available/existing-config /etc/nginx/sites-available/new-config
sudo vi /etc/nginx/sites-available/new-config
sudo ln -s /etc/nginx/sites-available/new-config /etc/nginx/sites-enabled/
sudo /usr/sbin/nginx -s reload