Skip to content

Instantly share code, notes, and snippets.

View aldwindelgado's full-sized avatar
💻
Keep grinding

Aldwin Delgado aldwindelgado

💻
Keep grinding
View GitHub Profile
@aldwindelgado
aldwindelgado / postgresql-update-thousand-rows-to-db.md
Last active April 24, 2020 01:49
Update thousands of rows in PostgreSQL efficiently

How to update thousand rows in PostgreSQL efficiently


File Path to be imported

  • /path/from/whenever.csv

NOTE: CSV is much more easier to understand than other spreadsheet formats


Steps using PSQL (PostgreSQL cmd)

  1. CREATE TEMP TABLE temp_table(my_column varchar(255));
@aldwindelgado
aldwindelgado / nginx.conf
Created April 6, 2018 09:38
Sample Nginx configuration for Glassfish
upstream sample-app {
server localhost:1234 weight=100 max_fails=5 fail_timeout=5;
}
server {
listen 80;
listen [::]:80;
server_name example.com;
return 301 https://example.com$request_uri;
}
@aldwindelgado
aldwindelgado / apache.conf
Created March 21, 2018 02:27
Apache proxy configuration for AngularJS 1 SEO support with Let's Encrypt Configuration as SSL/HTTPS
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName http://example.com
ServerAdmin admin@example.com
##
## MODULE EXPIRES
##
ExpiresActive On
ExpiresByType image/jpg "access plus 1 month"
@aldwindelgado
aldwindelgado / ssh_config
Created February 14, 2018 07:29
Sample configuration for SSH
Host ${SHORT_NAME}
HostName ${IP_ADDRESS}
User ${USER_NAME}
IdentityFile ~/.ssh/id_rsa
# Custom repositories
Host bitbucket-personal
HostName bitbucket.org
User ${BITBUCKET_USERNAME}
IdentityFile ~/.ssh/id_rsa
Host github-personal
@aldwindelgado
aldwindelgado / nginx.conf
Created February 6, 2018 10:54
NGINX proxy configuration for NON-SSL/HTTPS
server {
listen 80;
server_name www.example.com;
server_tokens off;
access_log /var/log/nginx/www.example.com_access.log;
error_log /var/log/nginx/www.example.com_error.log;
add_header X-Frame-Options DENY;
@aldwindelgado
aldwindelgado / nginx.conf
Last active February 6, 2018 10:47
Nginx proxy configuration for SSL/HTTPS using Let's Encrypt certificate.
server {
listen 80;
# for IPv6
# listen [::]:80;
server_name www.example.com;
return 301 https://www.example.com$request_uri;
}
server {
listen 443 ssl http2;
@aldwindelgado
aldwindelgado / ConvertStringToSha1Hash.java
Created November 30, 2017 01:50
Convert a string input to sha-1 hash
import org.apache.commons.codec.digest.DigestUtils;
import javax.xml.bind.DatatypeConverter;
public String convertStringToSha1Hash(String toBeConvertedString) {
try {
return DatatypeConverter.printHexBinary(DigestUtils.sha1(toBeConvertedString));
} catch (Exception ex) {
System.out.println("Something went wrong -> " + ex.getMessage());
return null;