Skip to content

Instantly share code, notes, and snippets.

@hute37
hute37 / install-alacritty-ubuntu.sh
Created October 2, 2020 10:18 — forked from Aaronmacaron/install-alacritty-ubuntu.sh
Install Alacritty on Ubuntu
#!/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
@hute37
hute37 / vim-shortcuts.md
Created August 28, 2020 12:16 — forked from tuxfight3r/vim-shortcuts.md
VIM SHORTCUTS

VIM KEYBOARD SHORTCUTS

MOVEMENT

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)
@hute37
hute37 / xrandr.sh
Created August 24, 2020 20:33 — forked from chirag64/xrandr.sh
#!/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 ]];
#!/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; \
@hute37
hute37 / PortSwitch.php
Created July 21, 2020 22:02 — forked from bueltge/PortSwitch.php
Port switch to get an workaround to use WordPress Multisite also without the default port 80.
<?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
@hute37
hute37 / pdf-cut-first-page.sh
Created June 15, 2020 15:38
How to preserve bookmarks when rearranging pages of a PDF file with tools like pdftk?
#!/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
#different aggregate functions
table = pd.pivot_table(df,index=['Sex','Pclass'],aggfunc={'Age':np.mean,'Survived':np.sum})
table
df.groupby(['Outlet_Type','Item_Type']).agg(mean_MRP=('Item_MRP',np.mean),mean_Sales=('Item_Outlet_Sales',np.mean))
df['Item_Weight'] = df.groupby(['Item_Fat_Content','Item_Type'])['Item_Weight'].transform(lambda x: x.fillna(x.mean()))
def filter_func(x):
return x['Item_Weight'].std() < 3
df_filter = df.groupby(['Item_Weight']).filter(filter_func)
df_filter.shape