Skip to content

Instantly share code, notes, and snippets.

@epynic
epynic / main.dart
Created May 25, 2021
minimal clevertap flutter example
View main.dart
import 'dart:convert';
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/material.dart';
import 'package:clevertap_plugin/clevertap_plugin.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
@epynic
epynic / Dockerfile
Last active Aug 5, 2019
Docker Inside Docker Example
View Dockerfile
FROM jenkins/jenkins
USER root
RUN mkdir -p /tmp/download && \
curl -L https://download.docker.com/linux/static/stable/x86_64/docker-docker-18.06.3-ce.tgz | tar -xz -C /tmp/download && \
rm -rf /tmp/download/docker/dockerd && \
mv /tmp/download/docker/docker* /usr/local/bin/ && \
rm -rf /tmp/download && \
groupadd -g 999 docker && \
usermod -aG staff,docker jenkins
@epynic
epynic / automl.php
Created May 12, 2019
CURL sample request to AutoML REST API
View automl.php
<?php
$image = $_POST['image'];
$key = trim(shell_exec('sudo -u service_name gcloud auth application-default print-access-token 2<&1')); // replace service_name with your service account name
$post='{"payload":{"image":{"imageBytes": "'.$image.'"}}}';
$curl = curl_init();
// The REST API URL can be found from the predict tab example replace with your account URL https://automl.googleapis.com/v1beta1/projects/quizappflutter/locations/us-central1/models/ICNXXXXXXXXXX41:predict
curl_setopt_array($curl, array(
 CURLOPT_URL => "https://automl.googleapis.com/v1beta1/projects/quizappflutter/locations/us-central1/models/ICNXXXXXXXXXX41:predict",
 CURLOPT_RETURNTRANSFER => true,
 CURLOPT_ENCODING => "",
@epynic
epynic / gist:4edafa94c880f6dc29d7ada7dfa116a6
Last active Feb 9, 2019
mysqldump - for Large DB and Repliaction
View gist:4edafa94c880f6dc29d7ada7dfa116a6
mysqldump -h RDS instance endpoint \
-u user \
-p password \
--port=3306 \
--single-transaction \
--routines \
--triggers \
--databases database database2 > path/rds-dump.sql
View gist:0547177634475a04af6c4c89bd567cdd
# create archive create verbose file
tar cvf output_tar_file.tar /home/epynic/
# tar.gz
tar cvzf output_tar_file.tar /home/epynic/
# tar.bz2
tar cvfj output_tar_file.tar /home/epynic/
# Untar - current directory - works for tar, gz
View gist:783a638293356194e8eb443607c5ea1d
ls /usr/bin | grep zip # list all zip files
ls /usr/bin | grep -c zip # list all zip files count
ls /usr/bin | grep -v zip # list all !zip files = not containing the pattern
ls /usr/bin | grep -n zip # list all zip files - frints the line:file
grep -i linux file_name.txt #find in files ignore case
@epynic
epynic / debugging.sh
Last active Dec 14, 2020
Bash Scripting Zero to Hero Examples
View debugging.sh
#debugging shellscripts -x would show the scrips line by line and output followed by
#!/bin/bash -x
TEST_VAR="test"
echo "$TEST_VAR"
#custom
#set -x / start debugginh
#set +x / stop
#-ex exit on stop
#-v prints shell before substitution are applied
#-vx
@epynic
epynic / pagination.php
Created Jul 28, 2018
CodeIgniter 3.x pagination config for Bootstrap 4
View pagination.php
<?php
$config['total_rows'] = 100;
$config['per_page'] = 20;
$config['num_tag_open'] = '<li class="page-item">';
$config['num_tag_close'] = '</li>';
$config['cur_tag_open'] = '<li class="page-item active"> <span class="page-link">';
$config['cur_tag_close'] = '</span> </li>';
$config['attributes'] = array('class' => 'page-link');
View (#1)
LIVE AT
http://epynic.asia/vacation/1.php
http://epynic.asia/vacation/2.php
<form action="1.php" method="post">
<input type ="text" name="number" placeholder="Enter Number !" >
<button type="submit" class="btn">Submit</button>
</form>
<?php