Skip to content

Instantly share code, notes, and snippets.

@cgois
cgois / srx.txt
Created June 2, 2020 19:53
[SwitchResX config] UltraWide settings for SwitchResX
PowerStrip timing parameters:
2560x1080=2560,48,32,80,1080,7,29,12,159841,1
Generic timing details for 2560x1080:
HFP=48 HSW=32 HBP=80 kHz=58 VFP=7 VSW=29 VBP=12 Hz=52
VESA detailed timing details:
PClk=159.84 H.Active=2560 H.Blank=160 H.Offset=32 HSW=32 V.Active=1080 V.Blank=48 V.Offset=7 VSW=29
# XFree86 modeline parameters:
@cgois
cgois / optimization_modules_test.py
Created May 6, 2020 03:20
[Python optimization modules test] Solve examples with CVXPY, PICOS and gurobipy, using Gurobi and Mosek
""
Solves examples using PICOS, CVXPY and Gurobipy interfaces,
with both Gurobi and MOSEK solvers.
If Python doesn't return any errors, all modules should be working.
"""
import numpy as np
import cvxpy as cp
import cvxopt as cvx
@cgois
cgois / panda_test
Created May 6, 2020 03:18
[PANDA sample] Simples test file for PANDA
Inequalities:
-1 0 0 0
1 0 0 -1
0 -1 0 0
0 1 0 -1
0 0 -1 0
0 0 1 -1
@cgois
cgois / planck.bashrc
Last active May 6, 2020 03:18
[Planck .bashrc] Set up paths for Planck cluster #dotfile
# Sample .bashrc for SuSE Linux
# Copyright (c) SuSE GmbH Nuernberg
# There are 3 different types of shells in bash: the login shell, normal shell
# and interactive shell. Login shells read ~/.profile and interactive shells
# read ~/.bashrc; in our setup, /etc/profile sources ~/.bashrc - thus all
# settings made here will also take effect in a login shell.
#
# NOTE: It is recommended to make language settings in ~/.profile rather than
# here, since multilingual X sessions would not work properly if LANG is over-
@cgois
cgois / least_squares_fit.py
Last active May 1, 2020 14:00
[Least squares fit] Fit dataset to given function by least squares #scipy
import scipy.optimize as opt
import numpy as np
# Using a linear function as example
func = lambda a, x: a[0] + a[1] * x
errfunc = lambda a, x, y, err: (y - func(a, x)) / err
optres = opt.least_squares(errfunc, [1., 1.], args=(x, y, err))
assert optres['success'], 'Optimizer has failed.'
@cgois
cgois / scatter_with_error.py
Created April 17, 2020 19:40
[Scatter plot with error bar] #pyplot
plt.figure(figsize=(9, 6))
plt.errorbar(x, y, xerr=xerr, yerr=yerr, fmt='o', capsize=3, markersize=5)
@cgois
cgois / darcula.vim
Created April 16, 2020 22:33
[Darcula vim scheme] Slightly modified darcula vim colorscheme
"
" Darcula colorscheme for VIM.
"
highlight clear
if exists("syntax_on")
syntax reset
endif
@cgois
cgois / .vimrc
Created April 16, 2020 22:30
[My .vimrc] My vim config file #dotfile
" General
set history=500
filetype plugin on
filetype indent on
set autoread
au FocusGained,BufEnter * checktime
" UI
@cgois
cgois / kitty.conf.default
Created April 16, 2020 22:26
[Sample kitt.conf] A commented kitt.conf sample file #dotfile
# vim:fileencoding=utf-8:ft=conf:foldmethod=marker
#: Fonts {{{
#: kitty has very powerful font management. You can configure
#: individual font faces and even specify special fonts for particular
#: characters.
font_family monospace
bold_font auto
@cgois
cgois / kitty.conf
Last active April 16, 2020 22:27
[My kitty.conf] My kitty configuration file #dotfile
# vim:fileencoding=utf-8:ft=conf:foldmethod=marker
#: Fonts {{{
font_size 14.0
adjust_line_height 4
# adjust_column_width 0
: }}}