Skip to content

Instantly share code, notes, and snippets.

View bitnbytesio's full-sized avatar

Harcharan Singh bitnbytesio

View GitHub Profile
@bitnbytesio
bitnbytesio / mysql-function.sql
Created June 29, 2018 06:31
My sql function to count similar words in comma seperated string
DROP FUNCTION IF EXISTS SPLIT_STRING;
DROP FUNCTION IF EXISTS SIMILAR_WORDS;
DELIMITER $$
CREATE FUNCTION SPLIT_STRING(str VARCHAR(255), delim VARCHAR(12), pos INT)
RETURNS VARCHAR(255)
RETURN REPLACE(SUBSTRING(SUBSTRING_INDEX(str, delim, pos),
LENGTH(SUBSTRING_INDEX(str, delim, pos-1)) + 1),
delim, '');
@bitnbytesio
bitnbytesio / setup-nginx-php.sh
Created July 14, 2018 18:01
Install required stuff/tools for php development on ubuntu
#!/bin/bash
// note: there is no error handling in this script, recommened way is to execute commands one by one
sudo apt -y update
sudo apt -y upgrade
sudo apt -y install wget
@bitnbytesio
bitnbytesio / example.ts
Last active February 21, 2020 11:59
Convert Object to GraphQL QueryString
// usage example
import { graphql, GraphqlQuery } from './obj-to-graphql';
const bookingsQuery: GraphqlQuery = {
name: 'bookings',
args: {
page: 1,
filter: { from: '2020-02-02' },
},
select: {
@bitnbytesio
bitnbytesio / awslogs-agent-setup.py
Created July 14, 2021 11:16
awslogs agent setup python script for python version 3.8
#!/usr/bin/python
# Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Amazon Software License (the "License"). You may not use
# this file except in compliance with the License. A copy of the License is
# located at http://aws.amazon.com/asl/ or in the "license" file accompanying
# this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
# CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.
@bitnbytesio
bitnbytesio / jquery-nested-nav.html
Created July 22, 2021 06:28
jquery based simple nested navigation
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.d-none {
@bitnbytesio
bitnbytesio / MySQL noinstall windows python3 scripts
Last active July 31, 2022 14:46
mysql-windows-noinstall-python3-scripts
# setup file
# run as admin
import os
cwd = os.getcwd()
mysql_dir = cwd.replace("\\", '/')
mysql_ini_file = "my.ini"