Skip to content

Instantly share code, notes, and snippets.

View ferdousulhaque's full-sized avatar
🚦

A. S. Md. Ferdousul Haque ferdousulhaque

🚦
View GitHub Profile
@abmmhasan
abmmhasan / PostgreSQL Queries and Commands: Export_Import.sql
Last active January 9, 2024 04:12
Useful PostgreSQL Queries and Commands
-- Import(FROM) / Export(TO) CSV file from/into a table
-- Ref: https://www.postgresql.org/docs/current/sql-copy.html
-- If processing all columns, no need column specification
-- If CSV file don't include header, remove 'HEADER' from below query
-- For Export, can also specify Query, instead of Table & Column name
COPY table_name (column_1, column_2, column_3, column_5)
[FROM/TO] 'csv_file_location' DELIMITER ',' CSV HEADER QUOTE '"' ESCAPE '"'
-- Dump database on remote host to file
-- Ref: https://www.postgresql.org/docs/current/app-pgdump.html
@SumonMSelim
SumonMSelim / .zshrc
Created May 9, 2019 18:18
My Terminal Configuration (oh-my-zsh+iTerm2)
# Path to your oh-my-zsh installation.
export ZSH=/Users/SumonMSelim/.oh-my-zsh
# Set name of the theme to load.
ZSH_THEME="powerlevel9k/powerlevel9k"
POWERLEVEL9K_MODE="awesome-fontconfig"
# User configuration
export TERM="xterm-256color"
export SHELL="/bin/zsh"
@oinopion
oinopion / read-access.sql
Created October 5, 2016 13:00
How to create read only user in PostgreSQL
-- Create a group
CREATE ROLE readaccess;
-- Grant access to existing tables
GRANT USAGE ON SCHEMA public TO readaccess;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readaccess;
-- Grant access to future tables
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readaccess;
@cawa87
cawa87 / base64.js
Last active August 26, 2021 07:36
JavaScript Convert an image to a base64 url
/**
* Convert an image
* to a base64 url
* @param {String} url
* @param {Function} callback
* @param {String} [outputFormat=image/png]
*/
function convertImgToBase64URL(url, callback, outputFormat){
var img = new Image();
img.crossOrigin = 'Anonymous';
@akalongman
akalongman / port_scanner.php
Created May 7, 2014 12:32
Port scanner on PHP
<?php
ini_set('max_execution_time', 0);
ini_set('memory_limit', -1);
$host = 'google.com';
$ports = array(21, 25, 80, 81, 110, 143, 443, 587, 2525, 3306);
foreach ($ports as $port)
{
$connection = @fsockopen($host, $port, $errno, $errstr, 2);