Skip to content

Instantly share code, notes, and snippets.

igniteflow /
Last active March 2, 2024 06:39
Print the number of business days and weekend days in a month
Print the number of business days and weekend days in a month
Example usage:
$ python ./ 2024 2
February, 2024 has 21 weekdays and 8 weekend days
Optional: Make the script executable
igniteflow / gist:e29d11a4d142207b59c6589e26817139
Last active November 2, 2021 11:57
Useful glab commands
# prints list of merge request ids only for a given user and target branch
glab mr list --assignee <gitlab-user-name> --target-branch <target-branch-name> | awk '{ print $1 }' | sed 's/!//g' | while read line; do glab mr update $line --target-branch <target-branch-name>; done
igniteflow /
Created October 8, 2018 08:48
Download all images from a Slack channel
import datetime
import requests
import os.path
TOKEN = 'xxxx-xxxx'
TARGET_DIR = './images/'
igniteflow /
Last active April 18, 2018 14:01
Google Drive: fix dotfile renaming

Google Drive replaces the leading dot in dot-filenames with an underscore. To undo this after downloading the files as a zip run

  # replaces leading underscores with dots
  rename -n 's/^_/./g' *  # first check
  rename 's/^_/./g' *  # now execute

After downloading the files be sure to set the correct permissions

igniteflow / .gitautouser
Created February 13, 2018 10:56
Git auto user. Switch git user/email based on active directory
#!/usr/bin/env python
Checks and sets git username and email based on dir root matching
1. Add the following to ~/.bashrc
function cd {
builtin cd "$@"
if [ -d ".git" ] ; then
igniteflow /
Last active May 13, 2018 11:48
Creating a command-line app with Python
  1. Create a
  #!/usr/bin/env python

  from distutils.core import setup

      name='My Thing',
igniteflow /
Last active December 14, 2023 06:31
Git commands
# pull changes from a single file inside a commit (useful when hotpatching)
git diff ..<hash> -- <filename> | git apply
# view changes in a file historically
git diff 'HEAD@{3 weeks ago}'..HEAD -- foo/
# view commits with patches in this branch only (assuming it was branched from master and is up-to-date)
# useful when reviewing tickets
git log master.. --patch --reverse
igniteflow /
Created November 25, 2016 12:44
Linux commands

Linux Commands


traceroute - print the route packets take to network host

ifconfig - interface configurator. view ip address and mac address

ping - (Packet INternet Groper) test connectivity between two nodes

igniteflow /
Created November 7, 2016 12:29
Debugging connection issues

nmap -p http,git

igniteflow /
Created October 3, 2016 11:03
How to mock an object property in Python
import mock
with mock.patch('', new_callable=mock.PropertyMock) as mock_my_property:
mock_my_property.return_value = 'my value'