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
<?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
#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 |
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
#displays the subtotal using margins and margins_name | |
# margins is a boolean field that should be made True if total values need to be printed. | |
# margins_name is the optional field where you can name the margin row/column in your grouped table. | |
table = pd.pivot_table(df,index=['Sex'],columns=['Pclass'],values=['Survived'],aggfunc=np.sum, margins=True, margins_name='Total_Survived') | |
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
import time | |
def fibonacci_sequence_of(num): | |
first_number = 0 | |
second_number = 1 | |
num = int(num) | |
if num == 0: | |
print ("Fibonacci of {} is {}".format(num,num)) | |
elif num ==1: | |
print ("Fibonacci of {} is {}".format(num,num)) | |
else: |
NewerOlder