Skip to content

Instantly share code, notes, and snippets.

View zubayerahamed's full-sized avatar
🕶️
Coffee, Coke, Code, Cool

Zubayer Ahamed zubayerahamed

🕶️
Coffee, Coke, Code, Cool
View GitHub Profile
@zubayerahamed
zubayerahamed / gulpfile.babel.js
Created November 7, 2020 12:58
Gulp file to automate WordPress theme development workflow
import gulp from 'gulp';
import yargs from 'yargs';
import sass from 'gulp-sass';
import cleanCSS from 'gulp-clean-css';
import gulpif from 'gulp-if';
import sourcemaps from 'gulp-sourcemaps';
import imagemin from 'gulp-imagemin';
import del from 'del';
import webpack from 'webpack-stream';
import uglify from 'gulp-uglify';
@zubayerahamed
zubayerahamed / application.properties
Created December 8, 2018 16:28
Postgresql database configuration for Spring Boot app
# Set here configurations for the database connection
spring.datasource.platform=postgres
spring.datasource.url= jdbc:postgresql://localhost:5432/postgres
spring.datasource.username=postgres
spring.datasource.password=**_password_**
spring.datasource.driver-class-name=org.postgresql.Driver
# Keep the connection alive if idle for a long time (need in production)
spring.datasource.dbcp2.test-while-idle=true
spring.datasource.dbcp2.validation-query=SELECT 1
@zubayerahamed
zubayerahamed / zpl_command.md
Created August 24, 2018 13:11
How to print ZPL file using terminal on linux

to see which printer is availabe in this system , simply type

lpstat -p -d

Output: printer HP-LaserJet-1200 is idle. enabled since Thu 09 Aug 2018 01:29:05 PM +06 printer Zebra-Technologies-ZTC-GK420t is idle. enabled since Fri 24 Aug 2018 05:54:04 PM +06 printer ZTC-GK420t is idle. enabled since Fri 24 Aug 2018 05:54:04 PM +06 system default destination: Zebra-Technologies-ZTC-GK420t

SSH Cheat Sheet

This sheet goes along with this SSH YouTube tutorial

Login via SSH with password (LOCAL SERVER)

$ ssh brad@192.168.1.29

Create folder, file, install Apache (Just messing around)

$ mkdir test

$ cd test

Postgres Cheatsheet

This is a collection of the most common commands I run while administering Postgres databases. The variables shown between the open and closed tags, "<" and ">", should be replaced with a name you choose. Postgres has multiple shortcut functions, starting with a forward slash, "". Any SQL command that is not a shortcut, must end with a semicolon, ";". You can use the keyboard UP and DOWN keys to scroll the history of previous commands you've run.

Setup

installation, Ubuntu

http://www.postgresql.org/download/linux/ubuntu/ https://help.ubuntu.com/community/PostgreSQL

@zubayerahamed
zubayerahamed / boolean-sort.js
Last active May 30, 2018 10:12
How to sort array of object in javascript (Dynamic Sort)
let a = [{aa:"1",xx:true},{aa:"10",xx:false},{aa:"2",xx:true},{aa:"11",xx:false},{aa:"3",xx:true},{aa:"12",xx:false},{aa:"4",xx:true},{aa:"13",xx:false},{aa:"5",xx:true},{aa:"14",xx:false},{aa:"6",xx:true},{aa:"15",xx:false},{aa:"7",xx:true},{aa:"16",xx:false},{aa:"8",xx:true},{aa:"17",xx:false},{aa:"9",xx:true},{aa:"18",xx:false}];
//a.sort(function(a,b){return a.xx-b.xx});
a.sort(function (x, y) {
// true values first
return (x.xx === y.xx) ? 0 : x ? -1 : 1;
// false values first
// return (x === y)? 0 : x? 1 : -1;
});
return JSON.stringify(a);
@zubayerahamed
zubayerahamed / cookie-example.html
Last active May 27, 2018 14:15
Cookie example
@zubayerahamed
zubayerahamed / SoapMessageHandler.java
Created May 9, 2018 08:29
Setting a custom cookie in the HTTP headers inside a SOAP Message handler
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.List;
import javax.xml.ws.handler.MessageContext;
import javax.xml.ws.handler.soap.SOAPHandler;
import javax.xml.ws.handler.soap.SOAPMessageContext;
@zubayerahamed
zubayerahamed / Base64Encoding.java
Created May 8, 2018 08:58
Base64 Encoding in Java
import org.apache.commons.codec.binary.Base64;
byte[] encodedBytes = Base64.encodeBase64("Test".getBytes());
System.out.println("encodedBytes " + new String(encodedBytes));
byte[] decodedBytes = Base64.decodeBase64(encodedBytes);
System.out.println("decodedBytes " + new String(decodedBytes));