Skip to content

Instantly share code, notes, and snippets.

View worldmind's full-sized avatar

Alexey Shrub worldmind

View GitHub Profile
@davidteren
davidteren / nerd_fonts.md
Last active September 19, 2024 00:58
Install Nerd Fonts via Homebrew [updated & fixed]
@justincbagley
justincbagley / How_to_Convert_Markdown_to_PDF.md
Last active August 27, 2024 09:13
How To Convert Markdown to PDF

How to convert markdown to PDF:

This post reviews several methods for converting a Markdown (.md) formatted file to PDF, from UNIX or Linux machines.

Using Pandoc:

$ pandoc How_I_got_svg-resizer_working_on_Mac_OSX.md -s -o test1.pdf
@alces
alces / ansible_local_playbooks.md
Last active August 21, 2024 16:57
How to run an Ansible playbook locally
  • using Ansible command line:
ansible-playbook --connection=local 127.0.0.1 playbook.yml
  • using inventory:
127.0.0.1 ansible_connection=local
@oanhnn
oanhnn / using-multiple-github-accounts-with-ssh-keys.md
Last active September 19, 2024 18:00
Using multiple github accounts with ssh keys

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
@IanHopkinson
IanHopkinson / lxml_examples.py
Created November 24, 2015 19:42
Examples of xpath queries using lxml in python
#!/usr/bin/env python
# encoding: utf-8
import lxml.etree
import lxml.html
import requests
xml_sample = """<?xml version="1.0" encoding="UTF-8"?>
<foo:Results xmlns:foo="http://www.foo.com" xmlns="http://www.bah.com">
<foo:Recordset setCount="2">
@shenwei356
shenwei356 / nested_dict.py
Created November 3, 2015 06:50
different implemention of nested dict in Python
#!/usr/bin/env python
# different implemention of nested dict in Python
from collections import defaultdict
# from: http://stackoverflow.com/questions/635483/what-is-the-best-way-to-implement-nested-dictionaries-in-python
class AutoVivification(dict):
def __getitem__(self, item):
try:
return dict.__getitem__(self, item)
@mobilemind
mobilemind / git-tag-delete-local-and-remote.sh
Last active September 20, 2024 09:38
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@mkaz
mkaz / web_timing.py
Created July 4, 2012 14:55
Use Selenium to Measure Web Timing
#!/usr/bin/env python
"""
Use Selenium to Measure Web Timing
Performance Timing Events flow
navigationStart -> redirectStart -> redirectEnd -> fetchStart -> domainLookupStart -> domainLookupEnd
-> connectStart -> connectEnd -> requestStart -> responseStart -> responseEnd
-> domLoading -> domInteractive -> domContentLoaded -> domComplete -> loadEventStart -> loadEventEnd
@sweenzor
sweenzor / logtest.py
Created February 9, 2012 19:59
Writing to syslog with Python's logging library
import logging
import logging.handlers
log = logging.getLogger(__name__)
log.setLevel(logging.DEBUG)
handler = logging.handlers.SysLogHandler(address = '/dev/log')
formatter = logging.Formatter('%(module)s.%(funcName)s: %(message)s')