Skip to content

Instantly share code, notes, and snippets.

View gargolito's full-sized avatar

Anthony Camilo gargolito

View GitHub Profile
@gargolito
gargolito / atom
Last active November 11, 2019 15:06
atom
atom
@gargolito
gargolito / Desktop Clock
Last active July 2, 2020 22:15
Transparent clock, set as always on top and you can still click on any application behind/under the clock.
I couldn't find a free desktop clock for MacOS and this solution wourked out great.
1. save clock.html
2. For MacOS only: install geektool https://www.tynsoe.org/v2/geektool/
3. drag a Web geeklet to desktop.
4. use file:///path/to/file.html in the url box
5. resize and position to your preference.
@gargolito
gargolito / python_logger_setup.txt
Last active January 3, 2019 19:41
python setup logger
"""Function setup as many loggers as you want"""
formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(module)s - line %(lineno)d - %(message)s')
def setup_logger(name, log_file, level=logging.DEBUG):
handler = logging.FileHandler(log_file)
handler.setFormatter(formatter)
logger = logging.getLogger(name)
logger.setLevel(level)
logger.addHandler(handler)
return logger
https://github.com/abrenaut/python-cheat-sheet
https://github.com/kjordahl/pythonic
https://github.com/geokai/class_dev_toolkit_hettinger
https://github.com/sanjanasekar/python_for_engineers_part3
https://github.com/sdodda/pybay
https://github.com/astar/big_ideas
https://github.com/sankalp58/pycon_raymond_hettinger
https://github.com/ZacharyRSmith/py-thinking-about-concurrency
https://github.com/jurekkow/raymonds-trinity
https://github.com/ilyarudyak/modernpython
class Track(object):
def __init__(self):
self.__var = None
@property
def var(self):
return self.__var
@pid.setter
def var(self, value):
# compare two directories
diff --brief --recursive --no-dereference --new-file --no-ignore-file-name-case /dir1 /dir2 > dirdiff_1.txt
rsync --recursive --delete --links --checksum --verbose --dry-run /dir1/ /dir2/ > dirdiff_2.txt
# Given a text file and an integer k, print the k most common words in the file (and the number of their occurrences) in decreasing frequency. https://www.johndcook.com/blog/2019/02/18/command-line-wizard/
cat stuff.txt | tr -cs A-Za-z '\n' | tr A-Z a-z | sort | uniq -c | sort -rn | sed ${1}q
GOTO https://your.jenkins.url/script
copy paste the below, update name of the project
click run, there will be no output. the project builds will be reset back to zero
item = Jenkins.instance.getItemByFullName("PROJECTNAME")
//THIS WILL REMOVE ALL BUILD HISTORY
item.builds.each() { build ->
build.delete()
}
item.updateNextBuildNumber(1)
@gargolito
gargolito / color printing
Last active March 11, 2019 20:51
#bash #python
with background
format \prefix[font_type;color;bgcolor+suffix
witout background
format \prefix[font_type;color+suffix
no color ---------------------------------------|
suffix -----------------| |
background ---------------| | |
font color ----------| | | | |
@gargolito
gargolito / include_path.py
Last active March 9, 2019 16:09
include alternate python module locations for import #python
# must be added before the module to be imported from the specified path
import sys
sys.path.append("/custom/path/to/modules")
import custom_module
[Unit]
Description=Demonstrate Bash
[Service]
ExecStartPre=/usr/bin/bash -c "/usr/bin/systemctl set-environment MYVAR=$(( 2 + 2 ))"
ExecStart=/usr/bin/ech "2 + 2 = ${MYVAR}"