Skip to content

Instantly share code, notes, and snippets.

@isaacpompa
isaacpompa / some_usefull_bash_commands.sh
Last active December 6, 2023 18:43
An other script to remember usefull bash commands and devOps utils (medium)
###########################
#### linux-permissions ####
###########################
# Display permissions in octal format; like 600
stat -c %a <file-name>
###########################
##### sys-admin-util ######
###########################
$ sudo /etc/init.d/mysql stop
$ sudo mysqld --skip-grant-tables & (enter para que te dé promt)
$ mysql -u root
> FLUSH PRIVILEGES; (dentro del cliente de MYSQL)
> SET PASSWORD FOR 'root'@'localhost' = PASSWORD ('123'); [ctrl+d para salir]
$ sudo mysql -u root -p (verificamos contraseña modificada)
$ ps aux | grep mysqld
$ sudo kill <pids> (listamos los PIDS de la instrucción anterior)
$ sudo /etc/init.d/mysql start
$ mysql -u root -p (escribir password modificado)
grep -vEc '200,OK|500,Internal\ Server\ Error|java.net.SocketException|org.apache.http.NoHttpResponseException|org.apache.http.conn.ConnectionTimeoutException' file.ext
@isaacpompa
isaacpompa / CurrentTime.java
Last active February 15, 2017 00:00
Get the string-friendly representation of time in milliseconds. Only using Java API.
private String getCurrentTime(){
final SimpleDateFormat dateFormat;
String currentTime = null;
Date date;
Long date_miliseconds = null;
try {
@isaacpompa
isaacpompa / getBodyResponse.java
Last active September 29, 2016 18:09
View the API response body
private String getBodyResponse(HttpURLConnection connection){
String line = null;
BufferedReader br = null;
StringBuilder sb = null;
String body = null;
int response_code;
InputStreamReader isr;
try {
@isaacpompa
isaacpompa / CompareBytes.java
Created September 7, 2016 17:00
Show how to compare two strings using the ASCII code representation and prints the non-coincidence
/**
* This class show how to compare two strings
* using the ASCII code representation.
*/
public class CompareBytes {
public CompareBytes(){
}
@isaacpompa
isaacpompa / clean_pg_cache.sh
Created August 11, 2016 17:10
Script to drop Postgres 9.1 cache over Ubuntu 14.04.4 LTS
#!/usr/bin/sudo bash
service postgresql stop
sync
echo 3 > /proc/sys/vm/drop_caches
service postgresql restart
@isaacpompa
isaacpompa / .gitignore
Last active August 29, 2015 14:26 — forked from octocat/.gitignore
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #