Skip to content

Instantly share code, notes, and snippets.

View jecs's full-sized avatar

José E. Cruz Serrallés jecs

  • New York University, Grossman School of Medicine
  • New York, NY
View GitHub Profile
@ppoffice
ppoffice / xstartup
Last active July 10, 2024 01:21
VNC xstartup for Ubuntu Desktop (Gnome)
#!/bin/sh
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
vncconfig -iconic &
export DESKTOP_SESSION=/usr/share/xsessions/ubuntu.desktop
export XDG_CURRENT_DESKTOP=ubuntu:GNOME
export GNOME_SHELL_SESSION_MODE=ubuntu
export XDG_DATA_DIRS=/usr/share/ubuntu:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop
dbus-launch --exit-with-session /usr/bin/gnome-session --systemd --session=ubuntu
@gavinb
gavinb / nvcc_warnings.md
Last active February 21, 2024 00:39
How to disable specific warnings with nvcc

We were seeing the following unexpected warnings in our builds:

C:/BuildAgent/work/19dd4d6ddfbe72aa/SecretProject/vcpkg_installed/x64-windows/include\fmt/format.h(771): warning : base class dllexport/dllimport specification differs from that of the derived class
C:/BuildAgent/work/19dd4d6ddfbe72aa/SecretProject/vcpkg_installed/x64-windows/include\fmt/format.h(3268): warning : base class dllexport/dllimport specification differs from that of the derived class

We use spdlog and fmt all over the place and weren't seeing these warnings elsewhere. Strangely there were not the usual error/warning codes that the compiler emits.
Then I noticed why - these diagnostics were preceded by the module name:

SomeFilter.cu
@genkuroki
genkuroki / Use Computer Modern Unicode fonts in Plots.jl.ipynb
Last active April 11, 2024 19:16
Use Computer Modern Unicode fonts in Plots.jl
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jecs
jecs / matlab_desktop_resize_fix.md
Last active March 29, 2019 15:35
Fix for MATLAB R2018a error 'Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: sun.awt.image.BufImgSurfaceData cannot be cast to sun.java2d.xr.XRSurfaceData'

The issue pops up when you resize the desktop, as is commonplace when you use VNC across multiple machines.

A good workaround for this issue is to install the latest Oracle Java 8.

Installing Oracle Java 8

If you are using Ubuntu, you can add the Oracle 8 ppa:

sudo add-apt-repository ppa:webupd8team/java
sudo apt update
sudo apt install oracle-java8-installer
@infosec-intern
infosec-intern / vscode.desktop
Last active June 24, 2024 17:26
A simple .desktop file for Visual Studio Code
[Desktop Entry]
Name=Visual Studio Code
Comment=Programming Text Editor
Exec=/usr/local/src/VSCode-linux-x64/code
Icon=/usr/local/src/VSCode-linux-x64/resources/app/resources/linux/code.png
Terminal=false
Type=Application
Categories=Programming;
@drmalex07
drmalex07 / README-setup-tunnel-as-systemd-service.md
Last active July 18, 2024 07:33
Setup a secure (SSH) tunnel as a systemd service. #systemd #ssh #ssh-tunnel #ssh-forward

README

Create a template service file at /etc/systemd/system/secure-tunnel@.service. The template parameter will correspond to the name of target host:

[Unit]
Description=Setup a secure tunnel to %I
After=network.target

Installation of IPOPT on LINUX

NOTE: this page is for a from-source install (useful if you want to contribute to CasADi). If you just want to evaluate CasADi quickly, use a binary install.

  • To get started quickly, start off by grabbing as many dependencies as possible from repositories.
  • Ubuntu: sudo apt-get install gcc g++ gfortran git cmake liblapack-dev pkg-config --install-recommends
  • Fedora: sudo yum install gcc gcc-c++ gcc-gfortran git cmake lapack-devel
  • To compile the Python interface, you also need SWIG and a decent Python installation:
  • Ubuntu: sudo apt-get install swig ipython python-dev python-numpy python-scipy python-matplotlib --install-recommends
  • Fedora: sudo yum install swig ipython python-devel numpy scipy python-matplotlib
@eyecatchup
eyecatchup / hosts
Last active July 12, 2023 08:53
Disable Skype ads: 1.) Add hosts to your hosts file 2.) Flush DNS resolver cache (ipconfig /flushdns)
# Block Skype ads
127.0.0.1 *.msads.net
127.0.0.1 *.msecn.net
127.0.0.1 *.rad.msn.com
127.0.0.1 a.ads2.msads.net
127.0.0.1 ac3.msn.com
127.0.0.1 ad.doubleclick.net
127.0.0.1 adnexus.net
127.0.0.1 adnxs.com
127.0.0.1 ads1.msn.com
@tuxfight3r
tuxfight3r / vim-shortcuts.md
Last active July 26, 2024 08:26
VIM SHORTCUTS

VIM KEYBOARD SHORTCUTS

MOVEMENT

h        -   Move left
j        -   Move down
k        -   Move up
l        -   Move right
$        -   Move to end of line
0        -   Move to beginning of line (including whitespace)
@samnang
samnang / gist:1759336
Created February 7, 2012 11:52
Install Bash version 4 on MacOS X
# Install Bash 4 using homebrew
brew install bash
# Or build it from source...
curl -O http://ftp.gnu.org/gnu/bash/bash-4.2.tar.gz
tar xzf bash-4.2.tar.gz
cd bash-4.2
./configure --prefix=/usr/local/bin && make && sudo make install
# Add the new shell to the list of legit shells