Skip to content

Instantly share code, notes, and snippets.

View basavyr's full-sized avatar
💻
Focusing

Robert Poenaru basavyr

💻
Focusing
View GitHub Profile
@basavyr
basavyr / macosFirstSetup.md
Last active June 23, 2024 09:53
MacOS First Setup

Initial setup for a developer oriented macOS

In this guide we will focus on the necessary steps, settings, and tools that are required in order to have an environment that is streamlined for development, research, and overal productivity; all while keeping an emphasiz on distraction-free and minimalism

OS level

  • We will always try to keep the operating system at the latest available version (stable releases only), so the very first step would be to make sure that our system has all the OS updates installed
  • At the time of writing this guide, my macOS version is Version 14.5 (23F79)

Categories

@basavyr
basavyr / description.md
Created March 12, 2023 12:45
running Mathematica script from the command line

Executing Mathematica Scripts Within the Command-Line

This guide will show how to run Wolfram Mathematica scripts right from the command-line, without using the Frontend.

Setting up the console environment (MacOS)

Technically, a Mathematica script can be executed from the command line using the Mathematica Kernel.

After installation of the Wolfram Mathematica application, default location of that executable kernel should be at /Applications/Mathematica.app/Contents/MacOS:

@basavyr
basavyr / flask_socketio_simple_app
Created March 16, 2022 06:28
quick flask-socketIO server app
# general imports
from flask_socketio import SocketIO
from flask_socketio import emit
from flask import Flask, render_template
from random import random
import time
from threading import Thread, Event
from threading import Lock
@basavyr
basavyr / gist:bcc8ec3fc1dc0de07a870682066843c1
Created March 5, 2022 10:50
setup a linux container for python development with python
# .bashrc
# User specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
# custom commands
alias ls='ls --color=auto'
@basavyr
basavyr / plot_label.py
Created February 19, 2022 18:21
create text label in python using scaled centering (relative to the plot size)
def ShowSolutions(n, id):
nqReduced = 4
nqM = 100
for i in range(n):
plotname = pathPrefix+foldername + 'plot-id'+str(i+1)+'.pdf'
fig, ax = plt.subplots()
plt.xlabel('q')
plt.ylabel(f'λi')
ax.text(0.15, 0.75, f'$\lambda_{i+1}$ | N={n}', horizontalalignment='center',
verticalalignment='center', transform=ax.transAxes)
@basavyr
basavyr / .bash_profile
Created February 12, 2022 13:10 — forked from frnhr/.bash_profile
Show current pyenv python version in bash prompt, and also color virtual envs differently
####
#### pyenv-virtualenv bash prompt customization
####
# pyenv
eval "$(pyenv init -)"
# pyenv-virtualenv:
@basavyr
basavyr / agnoster-pyenv
Created February 10, 2022 10:47 — forked from loganasherjones/agnoster-pyenv
Display pyenv environment on agnoster prompt
# vim:ft=zsh ts=2 sw=2 sts=2
#
# agnoster's Theme - https://gist.github.com/3712874
# A Powerline-inspired theme for ZSH
#
# # README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts).
# Make sure you have a recent version: the code points that Powerline
@basavyr
basavyr / ssh-key-generation.md
Created February 3, 2022 07:34 — forked from cybersamx/ssh-key-generation.md
Generate a new SSH key pair

Mac and Linux

  • Open Terminal

  • Check if you already have a SSH keypair generated. Do the following:

    $ ls -la ~/.ssh/id_rsa*
    

If the files exist, you already have SSH installed. IMPORTANT: But if you wish to regenerate the SSH key pair, at least back up your old SSH keys.

@basavyr
basavyr / iterm2_switch_automatic.md
Created January 26, 2022 12:52 — forked from FradSer/iterm2_switch_automatic.md
Switch iTerm2 color preset automatic base on macOS dark mode.

The latest beta (3.5) includes separate color settings for light & dark mode. Toggling dark mode automatically switches colors.

Vist iTerm 2 homepage to download the beta. Thanks @stefanwascoding.


  1. Add switch_automatic.py to ~/Library/ApplicationSupport/iTerm2/Scripts/AutoLaunch with:
@basavyr
basavyr / README.md
Created January 26, 2022 12:52 — forked from jamesmacfie/README.md
iTerm 2 - script to change theme depending on Mac OS dark mode

How to use

In iTerm2, in the menu bar go to Scripts > Manage > New Python Script

Select Basic. Select Long-Running Daemon

Give the script a decent name (I chose auto_dark_mode.py)

Save and open the script in your editor of choice.