Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Sheikh Hussnain hussnainsheikh

🎯
Focusing
View GitHub Profile
@hussnainsheikh
hussnainsheikh / json_to_csv.py
Created Nov 25, 2021
Python code to converts JSON data into CSV. Please change your dict obj according to your JSON data. Keep sharing!
View json_to_csv.py
import json
import csv
# Opening JSON file
f = open('productfeed.json')
# returns JSON object as
# a dictionary
data = json.load(f)
@hussnainsheikh
hussnainsheikh / delete_older_than.php
Last active Sep 5, 2021 — forked from tdebatty/delete_older_than.php
A simple PHP function to delete files older than a given age. **Updated to delete files in subdirectories.**
View delete_older_than.php
<?php
/**
* A simple function that uses mtime to delete files older than a given age (in seconds)
* Very handy to rotate backup or log files, for example...
*
* $dir String whhere the files are
* $max_age Int in seconds
* return String[] the list of deleted files
*/
@hussnainsheikh
hussnainsheikh / table-liquid.liquid
Last active Nov 25, 2021
Shopify: Show product Metafields on Product page in Table
View table-liquid.liquid
{%- comment -%} Metafields {%- endcomment -%}
{%- if product.metafields.xojson != blank -%} //change "xojson" with your scope of metafields, can be global or something else which you defined while creating them.
<div class="row container" id="Specifications">
<header class="section__header column small-12">
<h3 class="section__title heading h3">Product Attributes</h3>
</header>
<div class="row">
<div class="columns medium-6 small-12 tooltip-container">
<table role="presentation" style="width: 80%;background: #fff;border: solid 1px #ddd;margin-bottom: 1.25rem;table-layout: auto;">
<tbody>
@hussnainsheikh
hussnainsheikh / Lamp-stack on ubuntu with SSL on apache
Last active Aug 8, 2020
Install lamp-stack on Ubuntu with virtual host and SSL with certbot on apache. If you are facing any issue while installing ask me. Thank you!
View Lamp-stack on ubuntu with SSL on apache
#install lamp-stack by tasksel
sudo apt update && sudo apt upgrade
sudo apt install tasksel
sudo tasksel install lamp-server
#install phpmyadmin
sudo apt-get install -y phpmyadmin
#create db_user and grant access
@hussnainsheikh
hussnainsheikh / gcc-5.4.0-install.sh
Created Oct 13, 2019 — forked from jdhao/gcc-5.4.0-install.sh
The script will install GCC 5.4.0 on your CentOS 7 system, make sure you have root right. See https://jdhao.github.io/2017/09/04/install-gcc-newer-version-on-centos/ for more details.
View gcc-5.4.0-install.sh
echo "Downloading gcc source files..."
curl https://ftp.gnu.org/gnu/gcc/gcc-5.4.0/gcc-5.4.0.tar.bz2 -O
echo "extracting files..."
tar xvfj gcc-5.4.0.tar.bz2
echo "Installing dependencies..."
yum install gmp-devel mpfr-devel libmpc-devel -y
echo "Configure and install..."
View install_mysql.md

How to install mysql on ubuntu (which works)

first delete it in case a root password was previously created:

sudo apt-get purge mysql-server mysql-client mysql-common mysql-server-core-5.5 mysql-client-core-5.5
sudo rm -rf /etc/mysql /var/lib/mysql
sudo apt-get autoremove
sudo apt-get autoclean

then install it:

@hussnainsheikh
hussnainsheikh / Programs.cpp
Last active Feb 17, 2018
Simple Problems solution in C++. Please find the comment below for Problem statements.
View Programs.cpp
Program No 1:
//
#include "stdafx.h"
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
@hussnainsheikh
hussnainsheikh / shopify_delete_all_products.php
Last active Feb 6, 2018
Simple PHP script to delete all products from Shopify store using a private App(Api key and Pass). Just replace your App info and enjoy. Thanks
View shopify_delete_all_products.php
<?php
/**
*
*/
class ShopifyProducts{
public function getProducts($count = false, $page){
$apikey = 'API_KEY'; //Replace with your's
$pass = 'PASS'; //Replace with your's
$store = 'STORE_URL'; //Replace with your's
if ($count == true) {
@hussnainsheikh
hussnainsheikh / show_databases.php
Created Dec 19, 2017
Simplet php script to show all DATABASES which are created on a host. Enjoy!
View show_databases.php
<?php
$host = 'HOST'; //Hostname or Server ip
$user = 'USER'; //Database user
$pass = 'PASS'; //Database user password
$con = mysql_connect($host,$user,$pass);
if($con){
$count = 0;
@hussnainsheikh
hussnainsheikh / show_columns.php
Created Dec 19, 2017
Simple PHP script to show columns name of a database table.
View show_columns.php
<?php
$db = 'Database'; //Database name
$host = 'Database_host'; //Hostname or Server ip
$user = 'USER'; //Database user
$pass = 'Password'; //Database user password
$con = mysql_connect($host,$user,$pass);
if($con){