Skip to content

Instantly share code, notes, and snippets.

View zluvsand's full-sized avatar
🥝
heads I win, tails you lose :>

Zolzaya Luvsandorj zluvsand

🥝
heads I win, tails you lose :>
View GitHub Profile
@zluvsand
zluvsand / pull_request_template.md
Last active October 19, 2024 02:16
Pull Request Sample Template

🚀 Pull Request Template

📄 Description

This PR will introduce the following:

  • 🍉 major changes:
    • <insert_major_change_1>
    • <insert_major_change_2>
@zluvsand
zluvsand / globbing.md
Last active March 3, 2023 09:12
Bash Globbing cheatsheet

Bash Globbing cheatsheet

Character Description Example
* Matches any character 0+ times foo* matches any string beginning with foo
? Matches a character foo? matches any 4-character string beginning with foo
[] Matches any character inside the brackets *.[ch] matches any string ending with .c or .h
Class Inclusion
[:alnum:] (same as A-z0-9) Lowercase or uppercase alphabets or digits
@zluvsand
zluvsand / matcher6.py
Created May 31, 2022 10:51
Check match of an example employee
matcher.pairs[(matcher.pairs['name1']==name)|(matcher.pairs['name2']==name)]
@zluvsand
zluvsand / matcher11.py
Last active May 31, 2022 10:50
Create matches of groups for half a year
class Matcher():
def __init__(self, emp_df, hist_df, group_size):
self.emp_df = emp_df
self.hist_df = hist_df
self.group_size = group_size
def find_constraints(self, n=10):
if self.hist_df['date'].nunique()<=n:
recent_hist_df = self.hist_df
else:
@zluvsand
zluvsand / matcher10.py
Last active May 31, 2022 10:50
Create matches of pairs for half a year
matcher = Matcher(employee_df, history_df)
n_weeks = 26
for i in range(n_weeks):
matcher.get_matches(start_dt+(i+1)*delta)
matcher.hist_df
@zluvsand
zluvsand / matcher9.py
Last active May 31, 2022 10:51
See all matches of an employee
matcher.hist_df[(matcher.hist_df['name1']==name)|(matcher.hist_df['name2']==name)]
@zluvsand
zluvsand / matcher8.py
Last active May 31, 2022 10:51
Check constraints of an example employee
matcher.constraints[name]
@zluvsand
zluvsand / matcher7.py
Last active May 31, 2022 10:51
Create a few more matches of pairs
n_weeks = 5
delta = pd.Timedelta(7, unit='d')
for i in range(n_weeks):
matcher.get_matches(start_dt+(i+1)*delta)
matcher.hist_df
@zluvsand
zluvsand / matcher5.py
Created May 30, 2022 11:02
Inspect manager and direct reports of an example employee
employee_df[(employee_df['name']==name)|(employee_df['manager']==name)]
@zluvsand
zluvsand / matcher4.py
Last active May 30, 2022 11:08
See constraint of an example employee
name = 'Noah Rhodes'
matcher.constraints[name]