Skip to content

Commit

Permalink
Testing dockerfile for brew, add import history script
Browse files Browse the repository at this point in the history
  • Loading branch information
dhvcc committed Jul 1, 2024
1 parent 26f1362 commit 68cfd97
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .cfg/Dockerfile.test.brew
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
FROM ubuntu:22.04

WORKDIR /root

# ubuntu only
RUN apt update
RUN apt install -y curl git build-essential


# Install brew
RUN curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh | env NONINTERACTIVE=1 bash

RUN echo 'export PATH="$PATH:/home/linuxbrew/.linuxbrew/bin"' >> "$HOME/.bashrc"
ENV PATH="$PATH:/home/linuxbrew/.linuxbrew/bin"

RUN brew doctor

# Xclip ubuntu only
RUN brew install unzip xclip vim neovim

RUN brew install starship neofetch fzf btop wget \
pyenv nvm \
lsd fd ripgrep bat `# rust utils`

# INSTALL VIM THINGS
RUN curl -fLo '~/.vim/autoload/plug.vim' --create-dirs \
'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'

RUN rm -rf .bashrc .zshrc && curl -Lks https://raw.githubusercontent.com/dhvcc/configs/master/.cfg/install.sh | /bin/sh

# Install manually or in script
#ENV NVM_DIR="$HOME/.nvm"
#RUN test -s "/home/linuxbrew/.linuxbrew/opt/nvm/nvm.sh" && . "/home/linuxbrew/.linuxbrew/opt/nvm/nvm.sh"; nvm install 16

# ubuntu only
RUN apt install -y zsh
#
RUN "$HOME/.cfg/scripts/install-omb.sh"
RUN "$HOME/.cfg/scripts/install-omz.sh"

CMD bash
25 changes: 25 additions & 0 deletions .cfg/scripts/import-bash-history-to-zsh.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import time


def main():
timestamp = None
with open("~/.bash_history", "rt") as bash_history:
with open("~/.zsh_history", "wt") as zsh_history:
for line in bash_history.readlines():
line = line.rstrip('\n')
if line.startswith('#') and timestamp is None:
t = line[1:]
if t.isdigit():
timestamp = t
continue
else:
zsh_history.write(': %s:0;%s\n' % (timestamp or time.time(), line))
timestamp = None


if __name__ == '__main__':
main()

0 comments on commit 68cfd97

Please sign in to comment.