Skip to content

Instantly share code, notes, and snippets.

View sdon2's full-sized avatar
🏠
Coding is my Passion. I'm doing it right now.

Saravanakumar Arumugam sdon2

🏠
Coding is my Passion. I'm doing it right now.
View GitHub Profile
#!/bin/bash -e
# Run this script without any arguments for a dry run
# Run the script with root and with exec arguments for removing old kernels and modules after checking
# the list printed in the dry run
uname -a
IN_USE=$(uname -a | awk '{ print $3 }')
echo "Your in use kernel is $IN_USE"
OLD_KERNELS=$(
@sdon2
sdon2 / self-signed-certificate-with-custom-ca.md
Created January 11, 2023 14:08 — forked from fntlnz/self-signed-certificate-with-custom-ca.md
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
<?php
include_once('./db.class.php');
include_once('./fun.php');
ini_set('memory_limit', '-1');
set_time_limit(0);
//echo date('Y-m-d H:i:s',time())."<br/>";
$http_url='http://'.$_SERVER['HTTP_HOST'].':'.$_SERVER["SERVER_PORT"];
$db = new Db();
$_hd_url='http://'.$_SERVER['SERVER_NAME'].':'.$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
$sql="select * from fa_user_upload where (synchro_status=2 or synchro_status=0) and did=0 order by id asc limit 0,1 ";
@sdon2
sdon2 / keepalived-master.conf
Created August 25, 2022 05:09
Default keepalived.conf
vrrp_instance VI_1 {
state MASTER
interface eth0
virtual_router_id 51
priority 255
advert_int 1
authentication {
auth_type PASS
auth_pass 12345
}
@sdon2
sdon2 / 25-memcached.ini
Last active August 25, 2022 12:56
Default memcached configuration
;memcached.serializer=php
memcached.sess_locking=Off
memcached.sess_prefix=session.
memcached.sess_remove_failed=1
memcached.sess_consistent_hash=On
memcached.sess_number_of_replicas=1
memcached.sess_server_failure_limit=20
memcached.sess_binary=On
memcached.sess_connect_timeout=500
memcached.sess_randomize_replica_read=Off
@sdon2
sdon2 / haproxy-append.cfg
Last active August 4, 2022 07:52
Append this HAProxy configuration to separate certain requests from the application server
frontend http
bind *:80
mode http
acl reports_acl path_beg /peretemr/interface/financial_ajax/
use_backend reports_backend if reports_acl
default_backend app_backend
backend app_backend
@sdon2
sdon2 / html2pdf.js
Created April 11, 2022 13:04
Creates pdf on the fly
html2pdf().from(element).toPdf().get('pdf').then(function (pdf) {
window.open(pdf.output('bloburl'), '_blank');
});
@sdon2
sdon2 / select2.blade.php
Created March 8, 2022 10:49 — forked from amiranagram/select2.blade.php
Select2 multiple - Livewire/Alpine
<div
x-data="{
model: @entangle($attributes->wire('model')),
}"
x-init="
select2 = $($refs.select)
.not('.select2-hidden-accessible')
.select2({
theme: 'bootstrap',
dropdownAutoWidth: true,
@sdon2
sdon2 / db-backup.php
Last active February 25, 2022 08:46
Database Backup PHP Script
#!/usr/bin/env php
<?php
require __DIR__ . "/vendor/autoload.php";
use Spatie\DbDumper\Databases\MySql;
use Spatie\DbDumper\Compressors\GzipCompressor;
use Symfony\Component\Mailer\Transport;
use Symfony\Component\Mailer\Mailer as SymfonyMailer;
$.template = function (templateName, data) {
var htmlSplits = $('script[type="text/html"][data-name="' + templateName + '"]').html().split(/\!\{[ ]*(.+?)[ ]*\}/g);
var render = function (props) {
return function (tok, i) { return (i % 2) ? props[tok] : tok; };
};
if (data) {
htmlSplits = htmlSplits.map(render(data));
}
return htmlSplits.join('');
};