Skip to content

Instantly share code, notes, and snippets.

View erm3nda's full-sized avatar
😑
Expressionless master

m3nda erm3nda

😑
Expressionless master
  • n0n3
  • localhost
View GitHub Profile
@erm3nda
erm3nda / cpulimit-daemonize-sample.php
Last active November 27, 2015 04:52
Run some processes to show cpulimit work
<?php
/**
* PHP cpulimit daemon
*
* PHP cpulimit daemon checks for http calls with REQUEST_URI and limites those processes.
* This is related to https://github.com/opsengine/cpulimit/issues/40#issuecomment-73372492
* and http://www.tronko.es/servers/cpulimit-howto/
*
* LICENSE: This source file is subject to version 3.01 of the PHP license
* that is available through the world-wide-web at the following URI:
@erm3nda
erm3nda / javascript-check.php
Last active May 9, 2023 20:39
Check if javascript is enabled from the PHP server
<?php
/**
* The simplest way i found to check javascript vía PHP
* Not to run code if javascript, to tell server if a client
* has enabled Javascript. Check at $_SESSION['js'] for 1/0 true/false
*
* Need cookie to run
*
* I've not wrapped into a class nor a function because lazy
* It's easy too to put a include_once("javascript-check.php")
@erm3nda
erm3nda / wordpress-sqlite-instant-install.sh
Last active December 10, 2015 00:04 — forked from bburky/instant-wordpress.sh
Instant wordpress with sqlite3 install automation
#!/bin/bash
# One line original script:
# curl -L https://gio.io/wp.sh | bash
# One line ES_es:
# curl -L https://git.io/v4dSJ | bash
# You can define port by setting variable PORT before exec the script, otherwise fallback to 8080.
# curl -L https://git.io/v4dSJ | PORT=8888 bash
@erm3nda
erm3nda / wp-cli-sqlite-quick-install.sh
Last active March 27, 2023 11:41
Creates and serves a fresh wordpress sqlite powered install from scratch
#!/bin/bash
# wp-cli basic install script with sqlite database.
# requires installing wp-cli.phar following instructions from http://wp-cli.org/.
# Download wp-package, by default does download en_US package (--locale="en_US")
wp core download --locale="es_ES"
# U can later install another language package
# wp core language es_ES --activate
@erm3nda
erm3nda / souncloud-autoplay.user.js
Last active January 19, 2017 14:41
Enables autoplay for SoundCloud via userscript. Just cuz i bored doing a click everytime i join...
// ==UserScript==
// @name soundcloud autoplay
// @author erm3nda at gmail.com
// @author-www http://erm3nda.github.io
// @post-www http://erm3nda.github.io/2016/04/28/soundcloud-autoplay-gm-userscript.html
// @namespace souncloud-autoplay
// @icon http://files.softicons.com/download/social-media-icons/simple-icons-by-dan-leech/png/32x32/soundcloud.png
// @description Does autoplay first track of given category
// @include https://soundcloud.com/*
// @include https://soundcloud.com/charts/top/*
@erm3nda
erm3nda / cpulimit.py
Last active January 19, 2017 14:39
That's how you limit CPU usage of a process using signal module
#!/usr/bin/env python
import time, os, sys, signal
sleeptime = waketime = 0.01
def send(signal, pids):
for pid in pids:
os.kill(pid, signal)
@erm3nda
erm3nda / CustomRules.js
Created April 4, 2016 01:44 — forked from y3rsh/CustomRules.js
Fiddler Custom Rules
import System;
import System.IO;
import System.Windows.Forms;
import Microsoft.VisualBasic;
import Fiddler;
// GLOBALIZATION NOTE:
// Be sure to save this file with UTF-8 Encoding if using any non-ASCII characters
// in strings, etc.
//
@erm3nda
erm3nda / python-alsaaudio-applause-counter.py
Last active June 5, 2016 15:55
Detects applauses and does count them, plus replay them later, looped
#!/usr/bin/python
## This is an example of a simple sound capture script that counts Applauses (or other louder sounds).
## U can adjust the data value to fit your desired sound by it's amount of data lenght value
## The script opens an ALSA pcm for sound capture and several modules. Set
## various attributes of the capture, and reads in a loop,
## Volume is getting porcentual to medium values of starting noise, not just a fixed value, but not bulletproof
## Adjust your volume settings or change the desired value on `sound_raise`.
## TODO: Ad proper methods names and values
## TODO: Convert to a class
@erm3nda
erm3nda / javascript-audio-tag-extras.js
Last active January 21, 2019 17:11
Javascript html5 audioplayer swapper and remember me function
/*
This code it's a mix of some good javascript fixes, a cookie manager, and audio tag features.
It ads those functions:
- Auto stop other players when starting a new one (avoid multiple sounds at time)
- Remember status of player via cookie, to autostart radio if the user wants.
Related links:
http://stackoverflow.com/questions/19790506/multiple-audio-html-auto-stop-other-when-current-is-playing-with-javascript/29045474#29045474
http://stackoverflow.com/questions/14573223/set-cookie-and-get-cookie-with-javascript#24103596
*/
@erm3nda
erm3nda / python-network-tests.py
Last active September 3, 2016 00:04
Some tools for IP and websites with Python
# This is one of my regular scripts, i'd like to create my own functions to understand how everything works.
# Usually, when it comes to ip checking, people don't fully understand how it works, and tend to do some BAD checks.
# The MOST realiable way to check an IP it's let the system to tell you, cuz every language having networking can do that, need to do that.
# There's a few functions that uses various Python modules and functions to check and test IP and hostnames in many ways.
#!/usr/bin/env python
#! -*- coding: utf-8 -*-
import sys, re, socket, urllib2, httplib
from urlparse import urlparse