Skip to content

Instantly share code, notes, and snippets.

@vsobotka
vsobotka / settings.py
Last active November 5, 2020 23:22
Run your app in Xcode against the dev build - iOS, Python + Django, Create React App (CRA)
# Add your machine IP as allowed for Python server as well as for CRA (Create React App).
# You than have to start the server with this IP like:
# python manage.py runserver 192.168.0.168:8000
ALLOWED_HOSTS = [
'192.168.0.168'
]
# CRA_HOST and CRA_PORT are from the 'cra_helper' app installed in the project as well.
# Tells the base.html where to load the scripts from.
package main
import (
"fmt"
)
func main() {
fmt.Printf("Hello, world.\n")
}
random-string()
{
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w ${1:-32} | head -n 1
}
@vsobotka
vsobotka / .zshrc
Last active February 20, 2018 09:27
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=/home/vaso/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="robbyrussell"
# Change prefix from C-a from C-b
set -g prefix C-a
# Prefix has been remapped, C-b can be unbinded
unbind C-b
# Reduces the delay; more responsive command execution
set -s escape-time 1
# Indexing from 1 instead of 0
set -g base-index 1
set -g pane-base-index 1
@vsobotka
vsobotka / ubuntu_fonts_source-code-pro.sh
Last active April 6, 2019 16:03
Install Adobe Source Code Pro fonts on Ubuntu 16.04
# source: https://www.leggiero.uk/post/installing-adobe-source-code-pro-fonts/
wget https://github.com/adobe-fonts/source-code-pro/archive/2.010R-ro/1.030R-it.zip
unzip 1.030R-it.zip
mkdir -p ~/.fonts
mv source-code-pro-2.010R-ro-1.030R-it/OTF/*.otf ~/.fonts
rm -r 1.030R-it.zip source-code-pro-2.010R-ro-1.030R-it
fc-cache -f -v
@vsobotka
vsobotka / caps2ctrl.reg
Created December 29, 2015 11:44
Remap Caps to Ctrl in Windows 10
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,1d,00,3a,00,00,00,00,00
# Windows
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout
> new binary value named "Scancode Map" with value
> 00,00,00,00,00,00,00,00,02,00,00,00,1d,00,3a,00,00,00,00,00
> restart PC
# Debian
@vsobotka
vsobotka / install-tmux
Last active October 6, 2015 15:30 — forked from rothgar/install-tmux
Install tmux v2.0 on CentOS v6.6
# Install tmux on Centos release 6.5
# install deps
yum install gcc kernel-devel make ncurses-devel
# DOWNLOAD SOURCES FOR LIBEVENT AND MAKE AND INSTALL
curl -OL https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
tar -xvzf libevent-2.0.21-stable.tar.gz
cd libevent-2.0.21-stable
./configure --prefix=/usr/local
# Inspired by https://github.com/vinodpandey/blog/blob/master/vim7.3-centos-with-python-2.7.3-support.txt
# http://rm-rf.es/usrbinld-cannot-find-lpython2-6/
# Install neccessary packages for both Python installation and Vim compilation
# =============================================================================
sudo yum groupinstall 'Development Tools'
sudo yum install openssl-devel zlib ncurses ncurses-devel bzip-devel python-devel
# Missing python-devel will lead to /usr/bin/ld: cannot find -lpython2.6
# Configure and install Vim