Skip to content

Instantly share code, notes, and snippets.

View imkaka's full-sized avatar
🐣
Building good tiny habits/routines!

Anil Khatri imkaka

🐣
Building good tiny habits/routines!
View GitHub Profile
@imkaka
imkaka / ssh.txt
Created July 21, 2018 19:15 — forked from bradtraversy/ssh.md
SSH & DevOps Crash Course Snippets
# Login via SSH with password (LOCAL SERVER)
> ssh brad@192.168.1.29
# Create folder, file, install Apache (Just messing around)
mkdir test
cd test
touch hello.txt
sudo apt-get install apache2
# Generate Keys
@imkaka
imkaka / recover_from_git.py
Created August 11, 2019 11:27
A simple scrpit to automate the file recovering from git history, if you need to do that(in case).
import os
import re
import sys
from subprocess import Popen, PIPE
ROOT_FILES_PATH = '/home/<username>/path/to/your/file'
# REgex
STATIC_REGEX = re.compile(r'mobile/(.*?)(\.css|\.js|\.svg|\.less|\.png|\.jpg|\.woff|\.ttf|\.eot|\.txt|\.scss)')
@imkaka
imkaka / recover_from_git.py
Created August 11, 2019 11:27
A simple scrpit to automate the file recovering from git history, if you need to do that(in case).
import os
import re
import sys
from subprocess import Popen, PIPE
ROOT_FILES_PATH = '/home/<username>/path/to/your/file'
# REgex
STATIC_REGEX = re.compile(r'mobile/(.*?)(\.css|\.js|\.svg|\.less|\.png|\.jpg|\.woff|\.ttf|\.eot|\.txt|\.scss)')
@imkaka
imkaka / recover_from_git.py
Last active January 29, 2020 19:00
A simple script to automate the file recovering from git history, if you need to do that(in case). The following script print git command to recover all static files in any html template.
import os
import re
import sys
from subprocess import Popen, PIPE
ROOT_FILES_PATH = '/home/<username>/path/to/your/file'
# REgex
STATIC_REGEX = re.compile(r'mobile/(.*?)(\.css|\.js|\.svg|\.less|\.png|\.jpg|\.woff|\.ttf|\.eot|\.txt|\.scss)')
@imkaka
imkaka / python-logging.md
Created November 25, 2019 09:58 — forked from mariocj89/python-logging.md
Understanding logging in Python

Logging trees

Introduction

When applications are running in production, they become black boxes that need to be traced and monitored. One of the simplest, yet main, ways to do so is logging. Logging allows us - at the time we develop our software - to instruct the program to emit information while the system is running that will be useful for us and our sysadmins.

@imkaka
imkaka / GitCommitEmoji.md
Last active January 3, 2020 06:43 — forked from parmentf/GitCommitEmoji.md
Git Commit message Emoji
@imkaka
imkaka / hacto.py
Created October 7, 2021 07:17
Know If you have completed the Hacktoberfest Challenge!
#!/usr/bin/env python3
import json
import sys
from urllib import request
from datetime import datetime
from dateutil.tz import tzutc
from dateutil.parser import parse
@imkaka
imkaka / latency.markdown
Created May 27, 2023 11:53 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@imkaka
imkaka / reset_idea_trial.sh
Created May 6, 2024 11:18 — forked from patchthecode/reset_idea_trial.sh
reset intellij trial
#!/bin/sh
#https://github.com/PythonicNinja/jetbrains-reset-trial-mac-osx/blob/master/runme.sh
for product in IntelliJIdea WebStorm DataGrip PhpStorm CLion PyCharm GoLand RubyMine Rider; do
echo "Closing $product"
ps aux | grep -i MacOs/$product | cut -d " " -f 5 | xargs kill -9
echo "Resetting trial period for $product"