Skip to content

Instantly share code, notes, and snippets.

View karson's full-sized avatar
🎯
Focusing

Karson karson

🎯
Focusing
View GitHub Profile
@karson
karson / prereredisites.md
Created April 7, 2023 14:40
Pre requisites for install directadmin

Before installing DirectAdmin, there are some basic programs that you'll need. Check your Operating system and run the following codes:

CentOS 8

yum install iptables wget tar gcc gcc-c++ flex bison make bind bind-libs bind-utils openssl openssl-devel perl quota libaio \
libcom_err-devel libcurl-devel gd zlib-devel zip unzip libcap-devel cronie bzip2 cyrus-sasl-devel perl-ExtUtils-Embed \
autoconf automake libtool which patch mailx bzip2-devel lsof glibc-headers kernel-devel expat-devel \
psmisc net-tools systemd-devel libdb-devel perl-DBI perl-libwww-perl xfsprogs rsyslog logrotate crontabs file \
kernel-headers hostname
<?php
require_once 'vendor/autoload.php';
// Construct transport and client
$transport = new SocketTransport(array('127.0.0.1'),2775);
$transport->setRecvTimeout(60000); // for this example wait up to 60 seconds for data
$smpp = new SmppClient($transport);
// Activate binary hex-output of server interaction
$smpp->debug = true;
@karson
karson / gilab.yaml
Created February 17, 2023 16:16
gitlabdeploy_ssh
stages:
- deploy
.deploy:
stage: deploy
image: ubuntu:jammy
tags:
- docker
before_script:
- 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client rsync --force-yes -y )'
- eval $(ssh-agent -s)
@karson
karson / allow_remote_access.sql
Last active January 16, 2023 15:25
Allow remote access to existing user in Mysql Database
#for new user
CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mypass';
CREATE USER 'myuser'@'%' IDENTIFIED BY 'mypass';
GRANT ALL ON *.* TO 'myuser'@'localhost';
GRANT ALL ON *.* TO 'myuser'@'%';
FLUSH PRIVILEGES;
#For existing users
@karson
karson / conventional_commit_messages.md
Created October 11, 2022 14:51 — forked from qoomon/conventional-commits-cheatsheet.md
Conventional Commit Messages

Conventional Commit Messages

See how a minor change to your commit message style can make a difference. Examples

Have a look at CLI util git-conventional-commits to ensure this conventions and generate changelogs

Commit Formats

Default

@karson
karson / git-reset-remote.sh
Created October 5, 2022 10:34 — forked from CaroManel/git-reset-remote.sh
Reset remote git repository to delete all commits
rm -r .git
git init
(create files)
git add -A
git commit -m 'Initial commit'
git remote add origin <url>
git push --force --set-upstream origin master
@karson
karson / send_email_laravel.php
Created August 4, 2022 16:13
Send email in laravel
<?php
Mail::raw('Hello World!', function($msg) {$msg->to('karson@turbohost.co.mz')->subject('Test Email'); });
@karson
karson / randomstring.php
Created March 6, 2022 07:16
Generate Secure random string
<?php
//method1
$get_random_string = md5(microtime());
//method2
public static function get_quickRandom($length = 16)
{
$data_pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
return substr(str_shuffle(str_repeat($data_pool, $length)), 0, $length);
@karson
karson / index.js
Created September 11, 2020 15:35
Servir ficheiros estáticos
const express = require('express');
const path = require('path');
const app = express();
app.use(express.static(path.join(__dirname, 'build')));
app.get('/', function(req, res) {
res.sendFile(path.join(__dirname, 'build', 'index.html'));
});
app.listen(9000);
@karson
karson / functions.php
Last active September 3, 2020 22:18
Suporte para paypal em MZN - adiciojne o código no function.php do seu tema ativo
<?php
/**
* ==========Conversor de moeda para paypal=====
* Este codigo adiciona o suporte para o pagamento em meticais via paypal no woocommerce
* O código é baseado no tutorial do https://vinefruit.net/woocommerce-currency-tweak/
*
*/
/*Step 1 Code to use MZN currency to display Meticals in WooCommerce:*/