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 streamlit as st | |
class PagedDataframe: | |
def __init__(self, key, df, page_entries=10): | |
self.key = f"{key}_page" | |
self.df = df | |
self.page_entries = page_entries | |
self.last_page = len(df) // page_entries | |
if self.key not in st.session_state: |
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 | |
PORT=${1:-8000} | |
SERVING_DELAY_SECS=${2:-10} | |
command -v pv >/dev/null 2>&1 || { echo >&2 "pv requied but not installed. Exiting..."; exit 1; } | |
cat <<EOF > /tmp/index.html | |
<!doctype html> | |
<html> |
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
class BaseClass(object): pass | |
class Hello(BaseClass): | |
"""Example naive class""" | |
def __init__(self, arg1): | |
self.arg1 = arg1 | |
def __repr__(self): | |
return "arg1 {}".format(self.arg1) |
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
# Local-Remote synchronization of directories/files | |
# NOTE: Deletions are NOT considered yet. | |
# Usage | |
# ----- | |
# Local-remote sync: | |
# make -f Makefile.rsync lrsync SERVER=my_host PROJECT=project_name LOCAL_BASEDIR=/Users/my_name/dev REMOTE_BASEDIR=/home/my_name/dev | |
# | |
# Remote-local sync: | |
# make -f Makefile.rsync rlsync SERVER=my_host PROJECT=project_name LOCAL_BASEDIR=/Users/my_name/dev REMOTE_BASEDIR=/home/my_name/dev |
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
# Generate dep graph in maven | |
mvn org.fusesource.mvnplugins:maven-graph-plugin:reactor -Dhide-external=true |
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 | |
git filter-branch --commit-filter ' | |
if [ "$GIT_COMMITTER_NAME" = "Francisco Perez-Sorrosal" ]; | |
then | |
GIT_COMMITTER_NAME="Francisco Perez-Sorrosal"; | |
GIT_AUTHOR_NAME="Francisco Perez-Sorrosal"; | |
GIT_COMMITTER_EMAIL="fperezsorrosal@gmail.com"; | |
GIT_AUTHOR_EMAIL="fperezsorrosal@gmail.com"; | |
git commit-tree "$@"; |
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
sort -nr -t$'\t' -k<column> <file> | column -ts $'\t' |
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 java.io.UnsupportedEncodingException; | |
import java.math.BigInteger; | |
import java.nio.charset.Charset; | |
import java.security.MessageDigest; | |
import java.security.NoSuchAlgorithmException; | |
public class MainDigester { | |
public enum Digester { | |
SHA512("SHA-512"), |
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
public static boolean containsLoop(LinkedListNode list) { | |
LinkedListNode slowIterator = list, fastIterator = list; | |
// If a loop exists in the list, both iterators will be going round | |
// and round in the loop, and at some point, they will be equal | |
while (slowIterator != null && fastIterator != null) { | |
slowIterator = slowIterator.getNext(); | |
try { | |
fastIterator = fastIterator.getNext().getNext(); | |
} catch (NullPointerException npe) { | |
fastIterator = null; |
NewerOlder