To ignore some update for mac in terminal do:
sudo softwareupdate -l
Software Update Tool
Finding available software
Software Update found the following new or updated software:
* Security Update 2019-001-10.13.6
Security Update 2019-001 (10.13.6), 1768180K [recommended] [restart]
* iTunesX-12.8.2
iTunes (12.8.2), 273564K [recommended]
Then ignore it
sudo softwareupdate --ignore iTunesX
Note that X in the end. Just iTunes will not work.
вторник, 12 марта 2019 г.
четверг, 7 июня 2018 г.
Debug django code without server restart
It is nice to debug new function or whole django API without need to rebuild or restart server. Just copy/paste your code to django shell and test it there.
вторник, 5 июня 2018 г.
пятница, 1 июня 2018 г.
Debug django rest API from shell
It is possible to debug step by step Django rest framework API in pdb/ipdb debugger.
import ipdb #or pdb
_user = User.objects.get(
email__contains='root@root')#(2)valid user email
from rest_framework.test import APIRequestFactory
from rest_framework.test import force_authenticate
_factory = APIRequestFactory()
_request=_factory.post('', {})
force_authenticate(_request, _user)
from project.apps.users.api import ApiMySettingsView as api # (1)
_view=api.as_view()
responce=ipdb.runcall(_view,_request) #debug
#responce=_view() #just run
vars(responce)
http://www.django-rest-framework.org/api-guide/testing/
https://docs.python.org/3/library/pdb.html
- Import API on line (1)
- Replace root@root with valid email of user with correct permissions on line (2)
- Paste code in shell and run
- Execution will start on Django internal code. To go to your API use breakpoints.
import ipdb #or pdb
_user = User.objects.get(
email__contains='root@root')#(2)valid user email
from rest_framework.test import APIRequestFactory
from rest_framework.test import force_authenticate
_factory = APIRequestFactory()
_request=_factory.post('', {})
force_authenticate(_request, _user)
from project.apps.users.api import ApiMySettingsView as api # (1)
_view=api.as_view()
responce=ipdb.runcall(_view,_request) #debug
#responce=_view() #just run
vars(responce)
http://www.django-rest-framework.org/api-guide/testing/
https://docs.python.org/3/library/pdb.html
среда, 15 ноября 2017 г.
Automate check for a new Nvidia or Intel drivers
Sometimes you need to know when a new version of graphics driver is available and do not want to install constantly running in background tools from a manufacturer. Like Nvidia experience or Intel driver assist tool. Or you need notifications for the remote machine.
Luckily there is exists packages for Nvidia and Intel in the chocolatey project repository. And they updated pretty quickly. So using API it is possible to poll them for a new version.
https://github.com/kotofos/check-chocolatey-package-version
code example:
Luckily there is exists packages for Nvidia and Intel in the chocolatey project repository. And they updated pretty quickly. So using API it is possible to poll them for a new version.
https://github.com/kotofos/check-chocolatey-package-version
code example:
import xml.etree.ElementTree as ET import zipfile from io import BytesIO from urllib.request import urlretrieve, urlopen driver_url_map = { 'nvidia': 'https://chocolatey.org/api/v2/package/nvidia-display-driver', 'intel': 'https://chocolatey.org/api/v2/package/intel-graphics-driver', } def download(url): f = BytesIO() response = urlopen(url) f.write(response.read()) return f def get_current_version(name): url = driver_url_map[name] archive = download(url) zip = zipfile.ZipFile(archive) string = zip.read(url.rpartition('/')[-1] + '.nuspec').decode() string = "\n".join(string.split("\r\n")) root = ET.fromstring(string) tag_name = ('{http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd}'
'version') for elem in root.iter(): if elem.tag == tag_name: return elem.text if __name__ == '__main__': for name in ('nvidia', 'intel'): res = get_current_version(name) print('version for', name, res)
среда, 4 октября 2017 г.
Install software from chocolatey and cygwin with ansible
It is possible to use chocolatey to manage Windows computers from ansible.
choco install vlc -y works fine in Cygwin. And also over Cygwin's ssh server from ansible.
- name: Check command exist
shell: command -v procdump
register: procdump_res
- name: Install procdump
command: choco install procdump -y
when: procdump_res.rc == 1
choco install vlc -y works fine in Cygwin. And also over Cygwin's ssh server from ansible.
- name: Check command exist
shell: command -v procdump
register: procdump_res
- name: Install procdump
command: choco install procdump -y
when: procdump_res.rc == 1
среда, 27 сентября 2017 г.
list of all the DirectShow media types
Nice list of all the DirectShow media types https://gix.github.io/media-types/
Подписаться на:
Сообщения (Atom)