Skip to content

Latest commit

 

History

History
169 lines (121 loc) · 3.24 KB

File metadata and controls

169 lines (121 loc) · 3.24 KB

Miscellaneous


Table of Contents


Python Flask TypeError send_file

  • If a script is build for an older version of python flask following error might occur:
TypeError: send_file() got an unexpected keyword argument 'attachment_filename'
  • Fix this by using download_name instead of attachment_filename (see here)

Perlbrew

  • Install this handy management tool for perl installations, e.g. on Arch
sudo pacman -S perlbrew
perlbrew init
  • For cpan stuff
perlbrew install-patchperl
perlbrew install-cpanm
  • List perl versions available and install one
# List
perlbrew available
  perl-x.yz.a
  ...

# Install
perlbrew install perl-x.yz.a
  • Make a specific version permanent or similar stuff
# Current
which perl
  /usr/bin/perl

# List current used
perlbrew list
  * perl-x.yz.a
    perl-a.ab.c

# Switch version
perlbrew switch perl-a.ab.c

perlbrew use
  Currently using perl-a.ab.c

which perl
  /home/user/perlA/perlbrew/perls/perl-a.ab.c/bin/perl 
  • Disable usage permanent perlbrew usage
perlbrew switch-off
  • Exec script with specific version
perlbrew exec perl programm.pl
  • Update cpan modules
# Needed dep
cpanm App::cpanoutdated

# Update outdated
cpan-outdated -p | cpanm
  • Reinstall modules, e.g. when changing perl version
# Old version
perlbrew use perl-x.yz.a

# List all modules and install with new version (e.g. perl-a.ab.c)
perlbrew list-modules | perlbrew exec --with perl-a.ab.c cpanm
  • Troubleshooting
# Perl switch is not working permanently
echo 'source ~/perl5/perlbrew/etc/bashrc' >> ~/.bash_profile

# Threaded perl needed (not a good idea ^^)
perlbrew install perl-a.ab.c -Dusethreads --as threaded-perl-a.ab.c

# Install crashes - check language
cat /etc/locale.conf
  LC_MESSAGES=en_US.UTF-8

## Or just add
echo 'export LC_MESSAGES=en_US.UTF-8' >> ~/.bashrc

Python Virtual Environment

  • When, e.g. using pip or just playing around and not f_ck up system python, use a virtual environment
# Install python3-venv before
# Create
python -m venv /path/to/dir

# Activate
source /path/to/dir/bin/activate

# Disable
deactivate

Powershell Grep Like Before After

  • Sometimes it would be great to have something like a before/after in Windows, e.g. when playing with netstat
# Shows one line before and one after match
netstat -anbo | Select-String -Context 1 testbinary

    TCP    0.0.0.0:12345          0.0.0.0:0              ABHÖREN         7508
>  [testbinary.exe]
    TCP    192.168.0.2:139       0.0.0.0:0              ABHÖREN         4

C++ int 3 Instruction

  • 32 bit
__asm int 3
  • 64 bit
__debugbreak();

DebugBreak();

Diff and Visual Studio

  • Fast diff-like feature from developer console
devenv.exe /diff file1 file2