Skip to content

Instantly share code, notes, and snippets.

View komputronika's full-sized avatar

Komputronika komputronika

View GitHub Profile
@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 / 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 / index.php
Created May 14, 2021 11:32 — forked from oriolrivera/index.php
Simple Chat Using WebSocket and PHP Socket
<!DOCTYPE html>
<html>
<head>
<meta charset='UTF-8' />
<style type="text/css">
<!--
.chat_wrapper {
width: 500px;
margin-right: auto;
margin-left: auto;
@komputronika
komputronika / save_screenshot_with_select.py
Created May 17, 2019 03:02 — forked from lantip/save_screenshot_with_select.py
Script untuk menyimpan tangkap-layar dari laman KPU, dengan terlebih dulu memilih TPS
# Sebagai kelanjutan dari script saya sebelumnya (save_screenshot.py)
# Script ini membuka laman kpu, memilih berurutan Propinsi, Kabupaten, Kecamatan, Kelurahan dan TPS
# Di penghujung proses, dilakukan penyimpanan screenshot.
# Sebagai POC, saya batasi saja 5 TPS
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from datetime import datetime
import time
@komputronika
komputronika / readme.md
Created January 9, 2019 06:05 — forked from nonsintetic/readme.md
PHP - Get YouTube subscriber count with Youtube API v3

How to:

Here's a 'simple' way to get the YouTube subscriber number from Google's Youtube API v3:

  1. Go to https://console.developers.google.com/apis/library
  2. Log in with your Google account.
  3. Next to the logo click on 'Project' and 'Create project'. Name it whatever you want and click on 'Create'.
  4. Wait until the project is created, the page will switch to it by itself, it will take a couple of seconds up to a minute. Once it's done it will be selected next to the logo.
  5. Once it's created and selected, click on 'Credentials' from the menu on the left.
  6. Click on 'Create Credentials' and choose 'API Key'. You can restrict it to specific IPs, or types of requests (website, android, ios etc.) if you want, it's safer that way.
@komputronika
komputronika / firebase.php
Created December 7, 2018 07:36 — forked from krhoyt/firebase.php
Interact with Firebase from PHP.
<?php
// Constants
$FIREBASE = "_YOUR_FIREBASE_URL_";
$NODE_DELETE = "temperature.json";
$NODE_GET = "temperature.json";
$NODE_PATCH = ".json";
$NODE_PUT = "temperature.json";
// Data for PUT