Skip to content

Instantly share code, notes, and snippets.

View Microphone mute hotkey on macOS.md
  1. Open Automator.app
  2. Create new Quick Action
  3. Select Run AppleScript
  4. Add this:
set inputVolume to input volume of (get volume settings)
if inputVolume = 0 then
	set inputVolume to 100
	display notification "Volume set to 100" with title "✅ Microphone is on"
View python.md

Python - динамический интерпретируемый язык


Можно присвоить значение одной функции - другой функции

foo.__code__ = bar.__code__
@zmts
zmts / tokens.md
Last active Sep 27, 2022
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication
View tokens.md

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
@pbabics
pbabics / gitlab-gc.sh
Created Nov 11, 2016
Manual garbage collector for gitlab registry, it removes old revisions that are not referenced by any tag
View gitlab-gc.sh
#!/bin/bash
BASE_PATH=/var/opt/gitlab/gitlab-rails/shared/registry/docker/registry/v2/repositories
DRY_RUN=0
KEEP_LAST_IMAGES=10
RUN_GARBAGE_COLLECTOR=0
GITLAB_CTL_COMMAND=`which gitlab-ctl`
@eirnym
eirnym / metadata.py
Created Apr 11, 2015
SQLAlchemy dump SQL and metadata create_all and drop_all usage example. This is highly usable with aiopg and similar library where synchronised version of engine is not applicable.
View metadata.py
from sqlalchemy_dump import dump_sql
def create_all_sql(metadata):
return dump_sql(metadata.create_all, bind=True)()
def drop_all_sql(metadata):
return dumpsql(metadata.drop_all, bind=True)()
@ruario
ruario / README.md
Last active Apr 5, 2022
Installs (or updates) PPAPI Flash, so that it can be used by Chromium-based browsers
View README.md

Usage

If you use Ubuntu or a derivative distro, issue the following to install an appropriate version of Flash:

sudo add-apt-repository "deb http://archive.canonical.com/ubuntu `lsb_release -cs` partner" 
sudo apt update
sudo apt install adobe-flashplugin

If your distro does not provide a copy of Pepper Flash that works with Vivaldi, this script will download and install it for you. To use, click on the "Download ZIP" button listed on the GitHub Gist page and then unpack the .zip archive locally. You should now have a directory containing the file "latest-pepper-flash.sh".

@nealtodd
nealtodd / settings_test_snippet.py
Last active Nov 14, 2019
Skip migrations for a Django 1.7 test run
View settings_test_snippet.py
# If your test settings file doesn't import any other settings file
# then you can use the function directly:
def prevent_tests_migrate(db):
import django
from django.db import connections
from django.db.migrations.executor import MigrationExecutor
django.setup()
ma = MigrationExecutor(connections[db]).loader.migrated_apps
return dict(zip(ma, ['{a}.notmigrations'.format(a=a) for a in ma]))