Skip to content

Instantly share code, notes, and snippets.

View phase7's full-sized avatar
🧬
navigating

Ratul Roy phase7

🧬
navigating
View GitHub Profile
@phase7
phase7 / 55-bytes-of-css.md
Created November 13, 2022 04:13 — forked from JoeyBurzynski/55-bytes-of-css.md
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}

Keybase proof

I hereby claim:

  • I am phase7 on github.
  • I am ratulr (https://keybase.io/ratulr) on keybase.
  • I have a public key ASA_x2qIFkouiAUNaL_c1UZwO-2tdB2lBN5PLessQqEX3go

To claim this, I am signing this object:

@phase7
phase7 / pandas_data_process.py
Created March 7, 2022 09:49
Data Wrangling Example
from functools import partial
from io import BytesIO
from zipfile import ZipFile
import pandas as pd
import requests
zipurl = "https://eco2mix.rte-france.com/download/eco2mix/eCO2mix_RTE_energie_M.zip"
resp = requests.get(zipurl)
unzipped = ZipFile(BytesIO(resp.content))
xls_data = unzipped.open('eCO2mix_RTE_energie_M.xls').read()
@phase7
phase7 / clean_code.md
Created February 5, 2022 17:01 — forked from wojteklu/clean_code.md
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

@phase7
phase7 / 0main.md
Last active June 25, 2021 06:17 — forked from pandeiro/0main.md
Git Best Practices

Git Best Practices

This is a fairly common question, and there isn't a One True Answer, but still, this represents a consensus from #git

Read about git

Knowing where to look is half the battle. I strongly urge everyone to read (and support) the Pro Git book. The other resources are highly

@phase7
phase7 / postgres-cheatsheet.md
Created March 7, 2021 19:36 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@phase7
phase7 / copy_absolutepath_to_clipboard.sh
Last active August 13, 2020 08:54
This function goes to the ~/.bashrc file, and enables copying of absolute path of a folder/file to the clipboard. (requires xclip)
copy_abspath() { realpath $1 | tr -d '\n' | xclip -selection clipboard; }
@phase7
phase7 / netcheck.py
Last active July 24, 2020 04:23
Netcheck with python 3
#!/usr/bin/env python3
from subprocess import run
from time import sleep
def main():
for i in range(200):
print ("try", i+1)
run(["ping -c 10 8.8.8.8"], shell=True)
sleep(4)
@phase7
phase7 / hide_single_cell.py
Created March 9, 2020 16:57 — forked from Zsailer/hide_single_cell.py
Hide a single cell in Jupyter notebook
from IPython.display import HTML
from IPython.display import display
# Taken from https://stackoverflow.com/questions/31517194/how-to-hide-one-specific-cell-input-or-output-in-ipython-notebook
tag = HTML('''<script>
code_show=true;
function code_toggle() {
if (code_show){
$('div.cell.code_cell.rendered.selected div.input').hide();
} else {