As configured in my dotfiles.
start new:
tmux
start new with session name:
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 |
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: |
#!/bin/sh | |
## | |
# Xvfb headless startup | |
# | |
# #see: https://www.nomachine.com/AR10K00710 | |
## |
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: |
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 |
task convertFiles <<{ | |
fileTree("someFolder").matching{ include "**/*.txt"}.each{ aFile -> | |
exec{ | |
commandLine 'dos2unix' | |
args aFile.absolutePath | |
} | |
} | |
} |
def getVersionName = { -> | |
def hashStdOut = new ByteArrayOutputStream() | |
exec { | |
commandLine "git", "rev-parse", "--short", "HEAD" | |
standardOutput = hashStdOut | |
} | |
def buildNumberStdOut = new ByteArrayOutputStream() | |
exec { | |
commandLine 'echo', "$BUILD_NUMBER" |
[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))' - |
As configured in my dotfiles.
start new:
tmux
start new with session name: