Skip to content

Instantly share code, notes, and snippets.

View nnja's full-sized avatar
🐝
I'm a busy bee and may be slow to respond.

Nina Zakharenko nnja

🐝
I'm a busy bee and may be slow to respond.
View GitHub Profile
@nnja
nnja / connecting_logitech_g_hub.md
Created December 9, 2020 21:35
Logitech Hardware not appearing in G Hub on Mac OS Catalina

Documenting the process for having Logitech G Hub recognize your devices since there wasn't much information available online.

Note: in this case, I was trying to connect a Logitech G600 mouse to reprogram the programmable side buttons.

What worked for me:

  • Unplug the Logitech peripherals from your computer
  • Uninstall Logitech G Hub if has been installed before
  • Open System Preferences
  • Go to Security and Privacy
  • Press unlock to make changes
@nnja
nnja / fix_hugo_chapters.py
Created October 17, 2020 20:44
Python script to rename hugo chapters as standalone content pages and remove auto-generated content
import os
lines_to_remove = {
'pre = "<b>X. </b>"\n',
'chapter = true\n',
'### Chapter X\n',
'# Some Chapter title\n',
'Lorem Ipsum.',
}
@nnja
nnja / .pdbrc
Created August 2, 2019 12:55
My .pdbrc file with an interacti alias
# Install IPython: python3 -m pip install ipython
import IPython
from traitlets.config import get_config
cfg = get_config()
cfg.InteractiveShellEmbed.colors = "Linux" # syntax highlighting
cfg.InteractiveShellEmbed.confirm_exit = False
alias interacti IPython.embed(config=cfg)
@nnja
nnja / taking_notes.py
Last active June 28, 2019 16:49
Python script to select a random person to take notes in a meeting ⌨️🎉
import random
participants = ["Lena", "Seth", "Paul", "Suz", "Nina", "Burke", "Todd"]
print(f"{random.choice(participants)} is taking notes.")
@nnja
nnja / output.py
Created October 1, 2018 06:28
Show django database queries from the shell
In [2]: tweet = Tweet.objects.get(id=8)
In [3]: from django.db import connection
In [4]: connection.queries
Out[4]:
[{'sql': 'SELECT "tweeter_tweet"."id", "tweeter_tweet"."user_id", "tweeter_tweet"."text", "tweeter_tweet"."timestamp" FROM "tweeter_tweet" WHERE "tweeter_tweet"."id" = 8',
'time': '0.001'}]
@nnja
nnja / logging.py
Created October 1, 2018 06:26
Log every database query in django with DEBUG=True
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'file': {
'level': 'DEBUG',
'class': 'logging.FileHandler',
'filename': '/path/to/django/debug.log',
},
},
@nnja
nnja / pretty-log-alias.md
Created October 5, 2017 05:38
Create an alias for pretty logs

Set up a pretty git log

run:

git config --global alias.lg "log --graph --pretty=format:'%C(auto)%h -%d %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'"

to use:

git lg

@nnja
nnja / config-editor.md
Created October 5, 2017 05:00
Configure git editor

Set which editor git should use.

This is the program that will open during a commit with no -m flag, a merge, a rebase, etc...

Select from any installed editor. Examples:

  • emacs: emacs
  • vi: vi or vim