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)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This installs alacritty terminal on ubuntu (https://github.com/jwilm/alacritty) | |
# You have to have rust/cargo installed for this to work | |
# Install required tools | |
sudo apt-get install -y cmake libfreetype6-dev libfontconfig1-dev xclip | |
# Download, compile and install Alacritty | |
git clone https://github.com/jwilm/alacritty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#If no argument is specified, ask for it and exit | |
if [[ -z "$@" ]]; | |
then | |
echo "An argument is needed to run this script"; | |
exit | |
else | |
arg="$@" | |
#Basic check to make sure argument number is valid. If not, display error and exit | |
if [[ $(($(echo $arg | grep -o "\s" | wc --chars) / 2 )) -ne 2 ]]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## | |
# Microsoft Azure: show active VM via curl | |
# | |
# Azure OAUTH HOWTO from: | |
# - https://medium.com/@mauridb/calling-azure-rest-api-via-curl-eb10a06127 | |
# | |
AR=0; \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php # -*- coding: utf-8 -*- | |
declare( strict_types = 1 ); | |
/** | |
* Plugin Name: Port Switch | |
* Plugin URI: https://gist.github.com/bueltge/51013ab809f5f0f5e305c70c2d393fff | |
* Description: Port switch to get an workaround to use WordPress Multisite also without the default port 80. | |
* Version: dev | |
* Author: Frank Bültge | |
* Author URI: https://bueltge.de | |
* License: MIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
## | |
# from: https://unix.stackexchange.com/questions/17045/how-to-preserve-bookmarks-when-rearranging-pages-of-a-pdf-file-with-tools-like-p | |
# | |
pdftk A=in.pdf cat A2-end output temp.pdf | |
pdftk in.pdf dump_data > in.info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#different aggregate functions | |
table = pd.pivot_table(df,index=['Sex','Pclass'],aggfunc={'Age':np.mean,'Survived':np.sum}) | |
table |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df.groupby(['Outlet_Type','Item_Type']).agg(mean_MRP=('Item_MRP',np.mean),mean_Sales=('Item_Outlet_Sales',np.mean)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df['Item_Weight'] = df.groupby(['Item_Fat_Content','Item_Type'])['Item_Weight'].transform(lambda x: x.fillna(x.mean())) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def filter_func(x): | |
return x['Item_Weight'].std() < 3 | |
df_filter = df.groupby(['Item_Weight']).filter(filter_func) | |
df_filter.shape |
NewerOlder