Skip to content

Instantly share code, notes, and snippets.

View cpvargas's full-sized avatar
Focusing

Cristian Vargas cpvargas

Focusing
  • Texas A&M University
  • United States of America
View GitHub Profile
@cpvargas
cpvargas / createfolder.py
Created November 14, 2025 01:23
Create a folder if does not exist
def create_folder_if_not_exists(folder_path):
if not os.path.exists(folder_path):
os.makedirs(folder_path)
print(f"Folder created: {folder_path}")
else:
print(f"Folder already exists: {folder_path}")
@cpvargas
cpvargas / tarusage.txt
Last active May 30, 2024 23:54
tar compress and extract
compress
tar -czvf name-of-archive.tar.gz /path/to/directory-or-file
extract
tar -xzvf name-of-archive.tar.gz
@cpvargas
cpvargas / wget_google_drive_download.md
Created September 9, 2023 18:02 — forked from emxsys/wget_google_drive_download.md
Download Google Drive files with WGET

How to download files from Google Drive with WGET

Step 1. Get the ID of the file to download

  1. Get a shareable link from Google Drive by right-clicking the file and selecting Get Shareable Link.

  2. Examine the link to get the file's ID. Example:

    https://docs.google.com/open?id=[ID]

Step 2. Download the file with WGET

  1. Build the download URL using the ID obtained in Step 1. Example:
@cpvargas
cpvargas / dual_gaussian_fit.py
Created July 12, 2023 22:08
dual_gaussian_fit
#Example from stack overflow
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from scipy.optimize import curve_fit
#data generation
np.random.seed(123)
data=np.concatenate((np.random.normal(1, .1, 300), np.random.normal(2.0, .3, 300)))
@cpvargas
cpvargas / tile.sh
Last active June 1, 2023 21:15
Examples of montage
montage -tile 1x3 -geometry +0+2 mfmap_150_3_mJy.png mfmap_220_3_mJy.png mfmap_280_3_mJy.png mfmap_mJy.png
montage -tile 1x2 -geometry +0+0 differential_purity.png binned_completeness.png purcom.png
@cpvargas
cpvargas / xandr_brightness.txt
Created May 28, 2023 22:18
linux brightness xandr
#See your currently used display identifier
xrandr --prop | grep " connected"
#Check current brightness value
xrandr --prop --verbose | grep -A10 " connected" | grep "Brightness"
#Change the brightness value
@cpvargas
cpvargas / htop_conda.sh
Created March 8, 2022 16:38
htop conda
#for diff distro use the link https://docs.conda.io/en/latest/miniconda.html
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
sh Miniconda3-latest-Linux-x86_64.sh
conda install -c conda-forge htop
@cpvargas
cpvargas / virtualenv.txt
Created August 8, 2018 22:34
virtualenv
$ cd targetDirectory
$ source ./bin/activate
@cpvargas
cpvargas / mac_mouse_accel_off.txt
Last active January 14, 2023 14:17
mac mouse acceleration off
These are instructions on how to adjust mouse acceleration on a mac without downloading additional software.
Whenever you touch the mouse speed setting in preferences you will have to set the mouse acceleration again.
To set the acceleration open the terminal and type or paste:
defaults write .GlobalPreferences com.apple.mouse.scaling -1
To read the current value type or paste:
defaults read .GlobalPreferences com.apple.mouse.scaling
@cpvargas
cpvargas / P_ell.py
Created January 10, 2017 21:16
Power Spectrum of a CMB map with healpy
import numpy as np
import healpy as hp
#Joint Planck and WMAP9 CMB Map Reconstruction using LGMCA
#available at http://www.cosmostat.org/research/cmb/planck_wpr1/
wmap = hp.read_map('WPR1_CMB_muK.fits')
#to watch the map
#hp.mollview(wmap, title='CMB', unit=r'$\mu$K', min=-500,max=500)