Skip to content

Instantly share code, notes, and snippets.

View ipashchenko's full-sized avatar

Ilya ipashchenko

  • LPI ASC
View GitHub Profile
@ipashchenko
ipashchenko / keybindings.json
Created February 10, 2025 20:59 — forked from nikolovlazar/keybindings.json
VSCode key bindings to navigate like Neovim
[
// Navigation
{
"key": "ctrl-h",
"command": "workbench.action.navigateLeft"
},
{
"key": "ctrl-l",
"command": "workbench.action.navigateRight"
},
@ipashchenko
ipashchenko / clangd.md
Created May 27, 2023 23:23 — forked from Strus/clangd.md
How to use clangd C/C++ LSP in any project

How to use clangd C/C++ LSP in any project

tl;dr: If you want to just know the method, skip to How to section

Clangd is a state-of-the-art C/C++ LSP that can be used in every popular text editors like Neovim, Emacs or VS Code. Even CLion uses clangd under the hood. Unfortunately, clangd requires compile_commands.json to work, and the only way to painlessly generate it is to use CMake.

But what if I tell you you can quickly hack your way around that, and generate compile_commands.json for any project, no matter how compilcated? I have used that way at work for years, originaly because I used CLion which supported only CMake projects - but now I use that method succesfully with clangd and Neovim.

Method summary

Basically what we need to achieve is to create a CMake file that will generate a compile_commands.json file with information about:

Screen Quick Reference

Basic

Description Command
Start a new session with session name screen -S <session_name>
List running sessions / screens screen -ls
Attach to a running session screen -x
Attach to a running session with name screen -r <session_name>
@ipashchenko
ipashchenko / get_mojave_uvfits.py
Created April 27, 2020 21:51
Obtain data from MOJAVE
import os
import urllib
import bs4 as BeautifulSoup
import fnmatch
mojave_multifreq_url = "http://www.cv.nrao.edu/2cmVLBA/data/multifreq/"
mojave_u_url = "http://www.cv.nrao.edu/2cmVLBA/data/"
mojave_l_url = "http://www.cv.nrao.edu/MOJAVELBAND"
@ipashchenko
ipashchenko / rice_bias.py
Last active February 18, 2020 19:44
Description of Rice bias.
import numpy as np
from scipy.special import iv
from scipy.optimize import root_scalar
import matplotlib.pyplot as plt
label_size = 16
import matplotlib
matplotlib.rcParams['xtick.labelsize'] = label_size
matplotlib.rcParams['ytick.labelsize'] = label_size
matplotlib.rcParams['axes.titlesize'] = label_size
matplotlib.rcParams['axes.labelsize'] = label_size
@ipashchenko
ipashchenko / extra_params.ini
Last active October 4, 2019 16:16
Find bounding box of source emission.
[1803+784]
n_std_lowest_contour = 1
[J1800+78]
n_std_lowest_contour = 10
plot = no
out_fname = other_name.txt
@ipashchenko
ipashchenko / skeletonize.py
Last active March 21, 2019 13:50
Get skeleton of image
import os
import operator
import string
import copy
import itertools
import numpy as np
import networkx as nx
import scipy.ndimage as nd
import image_ops
from from_fits import create_image_from_fits_file
@ipashchenko
ipashchenko / forced_sorted_priors.py
Created March 14, 2019 21:57
Example of the forced sorted priors from polychord.
import numpy as np
# From pypolychord/priors.py
class UniformPrior:
def __init__(self, a, b):
self.a = a
self.b = b
def __call__(self, x):
@ipashchenko
ipashchenko / pymc_fit_G.py
Created July 10, 2018 12:18
Fitting beta_app and other stuff in pymc3
import pymc3 as pm
import numpy as np
betas, betas_err, thetas = np.loadtxt("/home/ilya/github/lags_utils.py/data.txt",
unpack=True)
thetas /= 180/np.pi
# Use beta_app and theta from Hovatta
@ipashchenko
ipashchenko / quick_xy.py
Created July 7, 2018 21:20
Fitting straight line with uncertainties in both variables (quickly:)
import numpy as np
import pymc3 as pm
import matplotlib.pyplot as plt
import corner
def quick_xy(x, y, x_err, y_err, plot_corner=True, plot_trace=True,
plot_posterior=True, plot_fit=True, mu_intercept=0, sd_intercept=20,
mu_gradient=0, sd_gradient=20, mu_true_x=5, sd_true_x=10,
n_x_pred=100, alpha_hpd=0.97, robust=False, n_tune=1000):