Skip to content

Instantly share code, notes, and snippets.

def filter_func(x):
return x['Item_Weight'].std() < 3
df_filter = df.groupby(['Item_Weight']).filter(filter_func)
df_filter.shape
#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
@hute37
hute37 / simple_fab
Created January 31, 2020 08:27 — forked from aananya27/simple_fab
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:
@hute37
hute37 / xvfb-xserverrc.sh
Last active February 27, 2024 14:01
Xvfb startup for nomachine headless (wayland) virtual desktop session
#!/bin/sh
##
# Xvfb headless startup
#
# #see: https://www.nomachine.com/AR10K00710
##
@hute37
hute37 / README
Created July 23, 2019 07:11 — forked from eqhmcow/README
docker wrapper
slightly-less-insecure-docker
wrapper around docker that perhaps makes it slightly less insecure
example usage:
DOCKER=/path/to/docker-wrapper
sudo $DOCKER run -it -v /etc/passwd:/etc/passwd -v /tmp:/tmp ubuntu
NOTE:
@hute37
hute37 / TypeclassDemo.scala
Created September 15, 2018 22:15 — forked from davegurnell/TypeclassDemo.scala
Example of the type class pattern in Scala
object TypeclasseDemo {
// The parts of the type class pattern are:
//
// 1. the "type class" itself -- a trait with a single type parameter;
//
// 2. type class "instances" for each type we care about,
// each marked with the `implicit` keyword;
//
// 3. an "interface" to the type class -- one or more methods
@hute37
hute37 / gist:dd60ea9a589aa9f1ca6a23f15e162fab
Created August 3, 2018 23:37 — forked from breskeby/gist:7858657
dos2unix on some text files with gradle
task convertFiles <<{
fileTree("someFolder").matching{ include "**/*.txt"}.each{ aFile ->
exec{
commandLine 'dos2unix'
args aFile.absolutePath
}
}
}
@hute37
hute37 / executeShellInGradle
Created June 30, 2018 00:30 — forked from rishabhmhjn/executeShellInGradle
Executing shell commands and getting output in gradle
def getVersionName = { ->
def hashStdOut = new ByteArrayOutputStream()
exec {
commandLine "git", "rev-parse", "--short", "HEAD"
standardOutput = hashStdOut
}
def buildNumberStdOut = new ByteArrayOutputStream()
exec {
commandLine 'echo', "$BUILD_NUMBER"
@hute37
hute37 / .gitconfig
Created May 19, 2018 10:52 — forked from rocketraman/.gitconfig
.gitconfig aliases useful for gitworkflows (article link TBD)
[alias]
# Basically `log --oneline --decorate --graph` with different colors and some additional info (author and date)
lg = log --graph --abbrev-commit --decorate --format=format:'%C(yellow)%h%C(reset) %C(normal)%s%C(reset) %C(dim white)%an%C(reset) %C(dim blue)(%ar)%C(reset) %C(auto)%d%C(reset)'
# lg (see above) with --first-parent
lgp = log --graph --abbrev-commit --decorate --format=format:'%C(yellow)%h%C(reset) %C(normal)%s%C(reset) %C(dim white)%an%C(reset) %C(dim blue)(%ar)%C(reset) %C(auto)%d%C(reset)' --first-parent
# List every branch, local and remote, in order of most recent to oldest commit, showing the branch's last commit and some last commit meta-data
br = for-each-ref --sort=-committerdate refs/heads/ refs/remotes/origin/ --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))' -

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name: