Skip to content

Instantly share code, notes, and snippets.

View bugcy013's full-sized avatar
πŸͺ„
Focusing

Dhanasekaran Anbalagan bugcy013

πŸͺ„
Focusing
View GitHub Profile
@bugcy013
bugcy013 / apache_log_rgx.py
Created July 17, 2019 11:27
Apache / Httpd Logs Regex
__author__ = 'dhana013'
import re
LOG_REGEX = '(?P<ip>[(\d\.)]+) - - \[(?P<date>.*?) -(.*?)\] "(?P<method>\w+) (?P<request_path>.*?) HTTP/(?P<http_version>.*?)" (?P<status_code>\d+) (?P<response_size>\d+) "(?P<referrer>.*?)" "(?P<user_agent>.*?)"'
line = '172.183.134.216 - - [12/Jul/2016:12:22:14 -0700] "GET /wp-content HTTP/1.0" 200 4980 "http://farmer-harris.com/category/index/" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; rv:1.9.3.20) Gecko/2013-07-10 02:46:11 Firefox/9.0"'
compiled = re.compile(LOG_REGEX)
match = compiled.match(line)
How to Implement
Since there is no Anaconda Support (yet) in Nexus 3 we will be using Nexus Raw repository to create a proxy to the Anaconda repository in https://repo.continuum.io
Creating Proxy
To create the proxy do the following.
Logon to the nexus with an admin user and click the gear icon on the top menu which is next to the search bar.
Select Repositories from side menu.
Click Create Repository
Select β€œraw (proxy)” from the list of recipies.
How to delete the tag
========================
git tag -d v0.1.1
git push origin :refs/tags/v0.1.1
How to create tag and push to remote
=======================================
git commit -am "bump up package version"
git tag v0.0.4
git push --tags
@bugcy013
bugcy013 / Heap Dump and thread dump and core dump differences.md
Last active June 28, 2024 15:01
Heap Dump and thread dump and core dump differences.

Heap dump

  • Collection of objects that are in memory (JVM)
  • is useful to analyse OOM situations.
  • then How to take jmap -dump:format=b,file=cheap.bin <pid>

Thread dump

@bugcy013
bugcy013 / get_specific_days.py
Created May 8, 2019 17:47
get_specific_days in a year
import pandas as pd
def get_specific_days(year, day):
return pd.date_range(
start=str(year),
end=str(year+1),
freq='W-%s' % day
).strftime('%Y%m%d').tolist() # %m%d%y
@bugcy013
bugcy013 / linux to windows keyless access.txt
Created May 2, 2019 09:30
linux to windows keyless access
Below are the steps to set up an SSH server on your windows host machine and configuring it to your Windows logon user account, using OpenSSH. (Keybased Authentication)
1. Download and install latest version of OpenSSH software from this link: http://www.mls-software.com/opensshd.html
2. During the installation process select "Local system" and "no privilege separation."
3. Uncomment the following lines in the sshd_config file.
C:\Program Files\OpenSSH\etc\sshd_config
- StrictModes no
- PubkeyAuthentication yes
- AuthorizedKeysFile .ssh/authorized_keys
@bugcy013
bugcy013 / pyenv_install.sh
Last active April 9, 2019 14:33
pyenv install
#!/usr/bin/env bash
# let's install pyenv
curl https://pyenv.run | bash
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
@bugcy013
bugcy013 / robbyrussell.zsh-theme
Created March 31, 2019 04:14
robbyrussell.zsh-theme
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )"
PROMPT='%{$fg_bold[cyan]%}%c%{$reset_color%} $(git_prompt_info) ${ret_status}%{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}βœ—"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
@bugcy013
bugcy013 / ZSH autocomplete.sh
Last active July 8, 2019 05:54
ZSH autocomplete
# we need add this content to $HOME/.zshrc
# autoload -Uz compinit; compinit
autoload -Uz compinit
typeset -i updated_at=$(date +'%j' -r ~/.zcompdump 2>/dev/null || stat -f '%Sm' -t '%j' ~/.zcompdump 2>/dev/null)
if [ $(date +'%j') != $updated_at ]; then
compinit -i
else
compinit -C -i
fi
@bugcy013
bugcy013 / run_ansible_role.yml
Last active March 21, 2019 17:40
Run Ansible Role
---
# Runs an ansible role
# Usage:
# ansible-playbook ./run_role.yml -e "role=dv_sysctl target=localhost"
# ansible-playbook ./run_role.yml -e "role=dv_inventory_update target=Hera" -i inventories/dv_inventry.py
# ansible-playbook ./run_role.yml -e "role=dv_inventory_update target=all" -i inventories/dv_inventry.py -l 172.16.30.150
#
- hosts: "{{ target }}"
become: "{{ sudo }}"
gather_facts: True