Skip to content

Instantly share code, notes, and snippets.

import socket
serverName = 'localhost'
serverPort = 12000
clientSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
clientSocket.connect((serverName, serverPort))
sentence = input('Input lowercase sentence: ')
clientSocket.send(sentence.encode())
@andersonfernandes
andersonfernandes / Alacritty Config
Created September 21, 2020 22:18
.config/alacritty/alacritty.yml
# Configuration for Alacritty, the GPU enhanced terminal emulator.
window:
decorations: none
startup_mode: Windowed
dynamic_title: true
dynamic_padding: true
padding:
x: 1
y: 1
@andersonfernandes
andersonfernandes / aws_downloader.rb
Created November 7, 2019 16:24
Script to download AWS S3 images
require 'aws-sdk'
credentials = Aws::Credentials.new(ENV['S3_ACCESS_KEY'], ENV['S3_SECRET_ACCESS_KEY'])
Aws.config.update(
region: 'sa-east-1',
credentials: credentials
)
objects_keys = []
list = [
{
id: 1,
name: 'ze',
age: 12,
app_id: 1,
url: 'www.1.com'
},
{
id: 1,
@andersonfernandes
andersonfernandes / tmux.conf
Created January 31, 2019 21:44
.tmux.conf
# Ring the bell if any background window rang a bell
set -g bell-action any
# Default termtype. If the rcfile sets $TERM, that overrides this value.
set -g default-terminal screen-256color
# Keep your finger on ctrl, or don't
bind-key ^D detach-client
# Create splits and vertical splits
@andersonfernandes
andersonfernandes / aws.rb
Last active February 8, 2021 21:46
AWS S3 storage wrapper using aws-sdk gem
require 'aws-sdk'
credentials = Aws::Credentials.new(ENV['S3_ACCESS_KEY'], ENV['S3_SECRET_ACCESS_KEY'])
Aws.config.update(
region: ENV['S3_REGION'],
credentials: credentials
)
s3 = Aws::S3::Resource.new(ENV['S3_REGION'], credentials: credentials)
!-------------------------------------------------------------------------------
! Xft settings
!-------------------------------------------------------------------------------
Xft.dpi: 96
Xft.antialias: false
Xft.rgba: rgb
Xft.hinting: true
Xft.hintstyle: hintslight
@andersonfernandes
andersonfernandes / c_bitwise_functions.c
Created October 4, 2016 11:59
Set of functions to manipulate bit in C language
int is_bit_i_set(unsigned char c, int i) {
unsigned char mask = 1 << i;
return mask & c;
}
void set_bit(unsigned char *c, int i) {
*c |= 1 << i;
}
void clear_byte(unsigned char *byte) {