Skip to content

Instantly share code, notes, and snippets.

View epynic's full-sized avatar
🌩️

Prasanha Kumar epynic

🌩️
View GitHub Profile
@epynic
epynic / sys.p
Created November 20, 2021 09:57
sys
#!/bin/python
import math
import os
import random
import re
import sys
@epynic
epynic / main.dart
Created May 25, 2021 11:54
minimal clevertap flutter example
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 August 5, 2019 17:54
Docker Inside Docker Example
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 07:55
CURL sample request to AutoML REST API
<?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 February 9, 2019 10:19
mysqldump - for Large DB and Repliaction
mysqldump -h RDS instance endpoint \
-u user \
-p password \
--port=3306 \
--single-transaction \
--routines \
--triggers \
--databases database database2 > path/rds-dump.sql
@epynic
epynic / gist:0547177634475a04af6c4c89bd567cdd
Created February 9, 2019 09:21
tar - all tar command example
# 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
@epynic
epynic / gist:783a638293356194e8eb443607c5ea1d
Last active February 9, 2019 09:13
linux-grep examples
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 September 16, 2022 16:43
Bash Scripting Zero to Hero Examples
#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 July 28, 2018 13:44
CodeIgniter 3.x pagination config for Bootstrap 4
<?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');
@epynic
epynic / (#1)
Last active December 21, 2015 06:49
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