Skip to content

Instantly share code, notes, and snippets.

View joka90's full-sized avatar

Johan Källström joka90

  • Linköping, Sweden
View GitHub Profile
@joka90
joka90 / config.lua
Created December 12, 2022 10:23
lvim config
--[[
lvim config for c++,c,cuda,cuda,bash,python
]]
vim.opt.backup = false -- creates a backup file
vim.opt.clipboard = "unnamedplus" -- allows neovim to access the system clipboard
vim.opt.cmdheight = 2 -- more space in the neovim command line for displaying messages
vim.opt.colorcolumn = "99999" -- fixes indentline for now
vim.opt.completeopt = { "menuone", "noselect" }
vim.opt.conceallevel = 0 -- so that `` is visible in markdown files
@joka90
joka90 / route_dhcp_multicast.sh
Created December 27, 2017 23:31
will configure a linux machine to route multicast trafic and start a dhcp server
#!/bin/bash
#stop on error
set -e
LOCAL_IF="enp2s0"
UPSTREAM_IF="enp2s0"
ifconfig ${LOCAL_IF} 192.168.2.1 netmask 255.255.255.0 broadcast 192.168.2.255
# Disabled by default!
echo "1" > /proc/sys/net/ipv4/ip_forward
@joka90
joka90 / simple_failover.sh
Last active September 13, 2016 18:20
Simple script to change firewallrules in DD-WRT to handle if the main server is not accessible. Switches back again when the main server becomes accessible again.
#!/bin/sh
MAIN_SERVER="192.168.1.8"
FAIL_OVER_SERVER="192.168.1.9"
PORT="80"
ACTIVE_SERVER=1
SAMPLING_TIME="5"
while :
do
while ping -c 1 $MAIN_SERVER &> /dev/null
@joka90
joka90 / Matlab focus stealing
Created June 24, 2016 14:11
Some logs of matlab window creation
Log to debug matlab window creation and focus stealing.
######################################### window id:s, nice to have while looking at the log
1. start matlab via xtruss, shows splash screen 0x02000001
2. main window shows 0x0240003d
3. run pause(10); figure(1) in matlab
4. new figure 0x02400095
Notice the workspace ( 4 ), w#000000CD (parent) have been the same for diffrent matlab start ups on diffrent workspaces and always the same for all matlab windows
@joka90
joka90 / Compile llvm and clang
Created March 27, 2016 17:15
compile llvm and clang with some nice backends and tools
# Get llvm
svn co http://llvm.org/svn/llvm-project/llvm/tags/RELEASE_370/final/ llvm
# Get clang
cd llvm/tools
svn co http://llvm.org/svn/llvm-project/cfe/tags/RELEASE_370/final/ clang
#Checkout Compiler-RT (required to build the sanitizers) [Optional]:
cd ../projects
@joka90
joka90 / Funny bash snippets
Created September 16, 2015 12:41
Funny bash snippets
#find no space befor ( for references in LaTex and add one
# Group () to \1 and \2
# ( { \ are terminated by \( \{ \\ etc.
find ./rtthesisex/ -name "*.tex" -type f -exec sed -i -E 's/([A-Za-z])(\([A-Za-z]* \\ref\{[A-Za-z1-9:]*\}\))/\1 \2/' {} \;
@joka90
joka90 / Change default compiler Matlab R2015a
Created August 25, 2015 10:07
Changes the Matlab/MEX default compiler to gcc 4.7 for the current user
#replace gcc with gcc 4.7 and g++ with g++-4.7
sed -e s/gcc/gcc-4.7/g /usr/local/MATLAB/R2015a/bin/mexopts.sh | sed s/g\+\+/g\+\+-4.7/g > ~/.matlab/R2015a/mexopts.sh
#start matlab and see if it works
@joka90
joka90 / gcc_4.7_for_Fedora_22.sh
Created August 25, 2015 09:54
How to build and install gcc 4.7 for Fedora 22 alongside gcc 5.1
#!/bin/bash
#Install build dependencies
sudo dnf groupinstall "Development tools"
sudo dnf install mpfr-devel gmp-devel libmpc-devel zlib-devel glibc-devel.i686 glibc-devel
wget http://mirror2.babylon.network/gcc/releases/gcc-4.7.4/gcc-4.7.4.tar.bz2
tar xvfj gcc-4.7.4.tar.bz2
cd gcc-4.7.4