Skip to content

Instantly share code, notes, and snippets.

View IamPhytan's full-sized avatar
🦊
GitLabing / Pythoning / LaTeXing

Damien LaRocque IamPhytan

🦊
GitLabing / Pythoning / LaTeXing
View GitHub Profile
@IamPhytan
IamPhytan / custom.js
Last active September 14, 2022 17:56
Jupyter Notebook Custom Keyboard Shortcuts / JetBrains keymap ?
// ~/.jupyter/custom/custom.js
/**
*
* Duplicate a current line in the Jupyter Notebook
* Used only CodeMirror API - https://codemirror.net
*
**/
CodeMirror.keyMap.pcDefault["Ctrl-D"] = function(cm){
// get a position of a current cursor in a current cell
@IamPhytan
IamPhytan / remren_git.sh
Created July 10, 2020 00:59
Small script to change a Git repo remote URL easily
# use : remren_git <ssh-url>
if [ "x$1" != "x" ]
then
git remote rename origin old-origin;
git remote add origin $1;
git push -u origin --all;
else echo "No arguments";
fi
@IamPhytan
IamPhytan / ode_example_sympy.py
Last active February 11, 2020 12:32
ODE Examples in Sympy
import sympy as sym
import numpy as np
import matplotlib.pyplot as plt
sym.init_printing()
# Integral calculation constants
a = 0
b = 20
h = 0.4
@IamPhytan
IamPhytan / rename_files.sh
Created September 9, 2019 00:33
Append text to filename
FOLDERPATH=RandomFolder
APPENDTEXT=_TextToAppend
for name in $FOLDERPATH/*;
do SUBSTRING=${name%.*};
ext=${name##*.};
mv $name $FOLDERPATH/${SUBSTRING##*/}$APPENDTEXT.$ext
done
@IamPhytan
IamPhytan / mat.bat
Last active June 29, 2019 02:02
Batch file to run MATLAB files in a terminal or in the command prompt
:: Run MATLAB scripts in CMD
:: Usage Examples
:: 'mat' is the name of my batch file
:: mat myScript.m
@echo off
:: Get filename by removing extension
set filename=%1
import json
import logging
import threading
import fibre
from fibre.utils import Logger
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
fibre_logger = Logger(verbose=logger.getEffectiveLevel() == logging.DEBUG)
@IamPhytan
IamPhytan / curl_loop.sh
Last active November 23, 2018 22:16
Infinite loop of curl piped on bash
curl https://gist.githubusercontent.com/IamPhytan/cb6dc65740eece7bbc085c3d0de3062a/raw/curl_loop.sh | bash
@IamPhytan
IamPhytan / .gitignore
Last active June 29, 2019 02:03
Standardized .gitignore for Python projects
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python