Skip to content

Instantly share code, notes, and snippets.

View SepehrImanian's full-sized avatar
🤠

Sepehr Imanian SepehrImanian

🤠
View GitHub Profile
@sivel
sivel / go-build.sh
Last active September 28, 2023 18:40
Ansible Binary Golang Module
go build helloworld.go
GOOS=windows GOARCH=amd64 go build helloworld.go
@wojteklu
wojteklu / clean_code.md
Last active November 15, 2024 07:19
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@mrhalix
mrhalix / gitlabIssueConverter.py
Last active August 1, 2023 12:58
Replace newlines in gitlab issue exported file's description, mostly needed by UTF-8 people
import re
file = open("issues.csv", "r")
text = file.read()
for i in re.findall(r'\".*?\"', text, flags=re.DOTALL):
text = text.replace(i, i.replace("\n", "'----'")) # replace \n with '----' in issue title and description
newf = open('issues-fixed.csv', 'w')
newf.write(text)
newf.close()
@mrhalix
mrhalix / job.yaml
Created February 14, 2023 09:39
A kubernetes cronjob which concurrently runs two commands when it starts, jobs: docker daemon + python script which uses docker pull,tag,push
apiVersion: batch/v1
kind: CronJob
metadata:
name: JOBNAME
namespace: NAMESPACE
spec:
schedule: "0 3 */10 * *"
jobTemplate:
spec:
template:
@mrhalix
mrhalix / snappfoodDelivery.py
Created July 8, 2023 12:04
Periodically check if you're in snappfood restaurant delivery area and receive notification on telegram whenever you are, crontab needed
import requests
import json
import time
headers = {
'authority': 'snappfood.ir',
'referer': 'https://snappfood.ir/search?query=%D9%86%D8%A7%D9%86%20%D8%B3%D8%AD%D8%B1&page=0',
'sec-ch-ua': '"Not.A/Brand";v="8", "Chromium";v="114", "Google Chrome";v="114"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Windows"',