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
# Display commits from HEAD while counting them (useful for rebase). | |
alias gloc="git log --oneline --decorate --color | cat -n | less" | |
# Create a temporary branch squashing the changes of the current branch into another one. | |
function gcotb { | |
CURRENT_BRANCH=$(git branch --show-current) | |
DEFAULT_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD --short | sed 's@^origin/@@') | |
if [ -n "$1" ] ;then | |
DEFAULT_BRANCH=$1 |
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
# Remap prefix from 'Ctrl + B' to 'Ctrl + A' | |
unbind C-b | |
set-option -g prefix C-a | |
bind-key C-a send-prefix | |
# Split panes using | and - | |
bind | split-window -h | |
bind - split-window -v | |
unbind '"' | |
unbind % |
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
#!/usr/bin/bash | |
extensions=$(ls -l | awk '{print $9}' | cut -f 2-99 -d '.' | uniq) | |
for ext in $extensions | |
do | |
echo "-- $ext --" | |
ls -l | grep ".$ext" | awk '{print $9,$5}' | column -t -s " " | |
done |
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
#!/usr/bin/env python3 | |
# To generate a certificate use: | |
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes | |
from http.server import HTTPServer, SimpleHTTPRequestHandler | |
import ssl | |
from pathlib import Path | |
port = 4443 |
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
from os import listdir, rename | |
from os.path import join, isdir | |
from readline import parse_and_bind | |
def main(): | |
print("Batch Rename - Developed by Telmo H. V. Silva") | |
print("-" * 50) | |
parse_and_bind("control-v: paste") |
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 Sudoku: | |
"""Sudoku validator""" | |
grid = [[0] * 9 for i in range(9)] | |
def __init__(self): | |
self.populate_grid() | |
self.print_grid() | |
self.validate_grid() |
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
xprop _NET_WM_PID | cut -d' ' -f3 |
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
from shutil import copyfile | |
copyfile("in.txt", "out.txt") | |
inputFile = open("in.txt", "r") | |
outputFile = open("out.txt", "a") | |
outputFile.write("\n\n") | |
for line in inputFile.readlines(): |
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 | |
var=$(synclient -l | grep TouchpadOff) | |
if [[ "$var" == " TouchpadOff = 0" ]]; then | |
synclient TouchpadOff=1 | |
else | |
synclient TouchpadOff=0 | |
fi |
NewerOlder