Skip to content

Instantly share code, notes, and snippets.

View komputronika's full-sized avatar

Komputronika komputronika

View GitHub Profile
@komputronika
komputronika / Eagle 9.6.2 on Ubuntu.md
Last active November 11, 2024 18:58 — forked from jbussdieker/README.md
Install Autodesk EAGLE 9.6.2 on Ubuntu
@komputronika
komputronika / test-composer-project-locally.md
Created August 12, 2024 16:46 — forked from wimvds/test-composer-project-locally.md
Test an existing composer project (create-project) locally

First, clone the repository of the project :

  mkdir /tmp/project-name
  git clone ...

Create a packages.json file in the root, containing the following :

@komputronika
komputronika / put_s3_file.php
Created June 3, 2024 04:35
Upload file to S3 server (Biznet)
<?php
use Aws\S3\S3Client;
use Aws\S3\Exception\S3Exception;
$temp_file ="mydoc.pdf";
$client = new S3Client([
"version" => "latest",
"region" => getenv("BIZ_ACCESS_REGION"),
@komputronika
komputronika / get_s3_file.php
Created June 3, 2024 04:23
Get file from private S3 Bucket (Biznet)
<?php
use Aws\S3\S3Client;
use Aws\S3\Exception\S3Exception;
$key = "myfolder/myfile.ext";
$client = new S3Client([
"version" => "latest",
"region" => getenv("BIZ_ACCESS_REGION"),
@komputronika
komputronika / tcp_tweaks.txt
Created April 15, 2024 07:35 — forked from n4ss1m/tcp_tweaks.txt
High performance tuning of Nginx
## From a post on the ML, apropos this:
## http://lowlatencyweb.wordpress.com/2012/03/20/500000-requestssec-modern-http-servers-are-fast.
## For sysctl.conf
net.ipv4.tcp_slow_start_after_idle = 0
echo "1768 64512" > /proc/sys/net/ipv4/ip_local_port_range
echo 1 > /proc/sys/net/ipv4/tcp_tw_recycle
echo 1 > /proc/sys/net/ipv4/tcp_tw_reuse
@komputronika
komputronika / pubsub.js
Created April 5, 2024 07:18 — forked from learncodeacademy/pubsub.js
Basic Javascript PubSub Pattern
//events - a super-basic Javascript (publish subscribe) pattern
var events = {
events: {},
on: function (eventName, fn) {
this.events[eventName] = this.events[eventName] || [];
this.events[eventName].push(fn);
},
off: function(eventName, fn) {
if (this.events[eventName]) {
@komputronika
komputronika / node-app-as-service-on-ubuntu.md
Created March 10, 2024 16:25 — forked from maliarslan/node-app-as-service-on-ubuntu.md
Run Node.js application as service on Ubuntu 16.04

Assuming that you have already installed Node.js on your system. If you haven't visit https://nodejs.org/en/download/package-manager/

First we need to create a service file into /lib/systemd/system to introduce our service.

So, with your favorite editor, open up a new file there with;

sudo nano /lib/systemd/system/mygreatestapp.service

Put the following contents in it;

[Unit]
@komputronika
komputronika / my.cnf
Created March 9, 2024 04:51 — forked from fevangelou/my.cnf
Optimized my.cnf configuration for MySQL/MariaDB (on Ubuntu, CentOS, Almalinux etc. servers)
# === Optimized my.cnf configuration for MySQL/MariaDB (on Ubuntu, CentOS, Almalinux etc. servers) ===
#
# by Fotis Evangelou, developer of Engintron (engintron.com)
#
# ~ Updated December 2021 ~
#
#
# The settings provided below are a starting point for a 8-16 GB RAM server with 4-8 CPU cores.
# If you have different resources available you should adjust accordingly to save CPU, RAM & disk I/O usage.
#
@komputronika
komputronika / cors.conf
Created March 1, 2024 13:59
NGINX Configuration: CORS and URL Rewrite
location /Folder {
add_header 'Access-Control-Allow-Origin' '*' always;
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' "*" always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Access-Control-Allow-Headers' "Authorization, Origin, X-Requested-With, Content-Type, Accept" always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS';
add_header 'Access-Control-Max-Age' 1728000;
@komputronika
komputronika / serializeObject.js
Created March 1, 2024 04:53
Serialize Form's Values to Object JSON
// Function to create JSON Object from <form> values
$.fn.serializeObject = function()
{
var o = {};
var a = this.serializeArray();
$.each(a, function() {
if (o[this.name] !== undefined) {
if (!o[this.name].push) {
o[this.name] = [o[this.name]];
}