Skip to content

Instantly share code, notes, and snippets.

View alvaro893's full-sized avatar

Álvaro Bolaños Rodríguez alvaro893

View GitHub Profile
@alvaro893
alvaro893 / TcpCommunication.cpp
Created April 29, 2020 08:43
TCP communication in QT
#include <QObject>
#include <QTcpServer>
#include <QTcpSocket>
/*
Tcp socket communication example
Note: the signal writeToSocket is used to write into the last opened socket
**/
@alvaro893
alvaro893 / Linux_tips.md
Last active February 24, 2024 14:31
Tips for Ubuntu / Manjaro

Wayland

software that works well in wayland see https://arewewaylandyet.com/

Fix resolution scaling of (some) GTK applications

on KDE select "Scalling themselves" under "X11 legacy applications" on display settings will fix blurring scaling on most of application but some will look strange (small icons and so on), you can fix it by adding

GDK_SCALE=2 GDK_DPI_SCALE=0.5

as envinroment variables to applications that won't scale correctly. orca-scaling

@alvaro893
alvaro893 / getHosts.sh
Created September 4, 2019 10:40
Scan network to get all IP addresses with their hostname in a ordered manner
#!/bin/bash
FILE=hosts.txt
sudo nmap -sP -PR 192.168.137.1/24 -oN $FILE
sed -i '/Host is/d' $FILE
sed -i '/MAC/d' $FILE
sed -i 's/Nmap scan report for//g' $FILE
sort $FILE -o $FILE
@alvaro893
alvaro893 / getAllipAddr.bash
Created June 18, 2019 09:17
Get all mac and their IP addresses on a network interface
#install it first
sudo apt install arp-scan
sudo arp-scan --interface enp0s25 -l
@alvaro893
alvaro893 / install-and-compile-cv2.sh
Created February 16, 2017 21:47
Compile opencv 3.1.0 for ubuntu with virtualenv
#!/bin/bash
# from http://www.pyimagesearch.com/2016/10/24/ubuntu-16-04-how-to-install-opencv/
sudo apt-get install build-essential cmake pkg-config libjpeg8-dev libtiff5-dev libjasper-dev libpng12-dev libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libxvidcore-dev libx264-dev libgtk-3-dev libatlas-base-dev gfortran python2.7-dev python3.5-dev -y
wget -O opencv.zip https://github.com/Itseez/opencv/archive/3.1.0.zip
unzip opencv.zip
#contribut packages
wget -O opencv_contrib.zip https://github.com/Itseez/opencv_contrib/archive/3.1.0.zip
unzip opencv_contrib.zip
@alvaro893
alvaro893 / compile_and_run_libqmi.sh
Last active May 10, 2021 10:08
script to compile and run libqmi (works in raspberry pi)
#!/bin/bash
# instructions in INSTALL file on repository https://github.com/freedesktop/libqmi/
git clone https://github.com/freedesktop/libqmi/
cd libqmi
git checkout 1.28.2
# get dependencies libraries (Ubuntu)
sudo apt-get install glib-networking libmbim-glib-dev autoconf-archive python
# compilation
@alvaro893
alvaro893 / Javascript_basics.md
Created November 16, 2016 22:19
Javascript utils
@alvaro893
alvaro893 / adb_tricks.md
Last active May 12, 2017 11:39
Collection of handy adb commands and tricks

Enable android debugging over tcp/ip in two steps

  • connect the phone to the pc using the usb port
  • Enable adb over network in Developer options
  • Go to the terminal and look for your phone
adb devices
  • and then use the device id that you got:
@alvaro893
alvaro893 / ViewController.h
Last active May 14, 2016 09:42
objetive-c example for apple app
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@property (weak, nonatomic) IBOutlet UITextField *waterTextField;
@property (weak, nonatomic) IBOutlet UITextField *ratioTextField;
@property (weak, nonatomic) IBOutlet UITextField *coffeeTextField;
- (IBAction)calculateButtonPressed:(id)sender;
@alvaro893
alvaro893 / open_soft_keyboard_android.java
Last active February 8, 2016 14:11
Forces to Open the soft keyboard in Android
InputMethodManager imm =(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);
/**
* Also you can add this to the Manifiest file:
* android:windowSoftInputMode="stateVisible"
* inside of the <activity> you want
* /