Skip to content

Instantly share code, notes, and snippets.

View ivanionut's full-sized avatar
🎯
Focusing

Ivan Ionut ivanionut

🎯
Focusing
View GitHub Profile
@ivanionut
ivanionut / UDF_isWebCEO.cfm
Created February 10, 2016 18:31 — forked from JamoCA/UDF_isWebCEO.cfm
Identify WebCEO Bot Request - Block unwanted page requests from automated Competitor Metrics & Backlink Spy (They don't provide a way for sites to opt-out or use WebCEO-specific robots.txt rules.)
<cfscript>
/* 1/4/2016 Identify WebCEO Bot Request (https://www.webceo.com/webceo-bots.htm)
Block unwanted page requests from automated Competitor Metrics & Backlink Spy (They don't provide
a way for sites to opt-out or use WebCEO-specific robots.txt rules.)
*/
function isWebCEO(){
return YesNoFormat(ListFind("97.107.131.214,69.164.220.17,69.164.220.10,69.164.208.136,69.164.208.68,97.107.135.120,97.107.135.14,69.164.212.131,97.107.133.236,97.107.131.160", CGI.Remote_Addr) OR Findnocase("seo-audit-check-bot", CGI.http_User_Agent) OR Findnocase("online-webceo-bot", CGI.http_User_Agent));
}
</cfscript>
@JamoCA
JamoCA / limiter_UDF.cfm
Last active April 10, 2025 13:46
An update to a ColdFusion-based limiter UDF to throttle requests. Using HTTP status 429, CacheGet/Push (for automatic collection flushing) and cookie filters.
<cffunction name="limiter">
<!---
by Charlie Arehart, [email protected], in 2009, updated 2012
http://www.carehart.org/blog/client/index.cfm/2010/5/21/throttling_by_ip_address
- Throttles requests made more than "count" times within "duration" seconds from single IP.
- sends 503 status code for bots to consider as well as text for humans to read
- also logs to a new "limiter.log" that is created automatically in cf logs directory, tracking when limits are hit, to help fine tune
- note that since it relies on the application scope, you need to place the call to it AFTER a cfapplication tag in application.cfm
- updated 10/16/12: now adds a test around the actual throttling code, so that it applies only to requests that present no cookie, so should only impact spiders, bots, and other automated requests. A "legit" user in a regular browser will be given a cookie by CF after their first visit and so would no longer be throttled.
- I also tweaked the cflog output to be more like a csv-format output
@fevangelou
fevangelou / my.cnf
Last active January 27, 2025 11:12
Optimized my.cnf configuration for MySQL/MariaDB (on cPanel/WHM servers)
# === Optimized my.cnf configuration for MySQL/MariaDB (on cPanel/WHM servers) ===
#
# by Fotis Evangelou, developer of Engintron (engintron.com)
#
# ~ Updated September 2024 ~
#
#
# 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.
#
@wizioo
wizioo / gitignore_per_git_branch.md
Last active April 24, 2025 04:55
HowTo have specific .gitignore for each git branch

How to have specific .gitignore for each git branch

Objective

My objective is to have some production files ignored on specific branches. Git doesn't allow to do it.

Solution

My solution is to make a general .gitignore file and add .gitignore.branch_name files for the branches I want to add specific file exclusion. I'll use post-checkout hook to copy those .gitignore.branch_name in place of .git/info/exclude each time I go to the branch with git checkout branch_name.

@geoffwatts
geoffwatts / sds011.py
Created January 25, 2016 22:57
Read an SDS011 Laser PM2.5 Sensor (Nova PM Sensor) with Python
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import serial, time, struct
ser = serial.Serial()
ser.port = "/dev/cu.wchusbserial1410" # Set this to your serial port
ser.baudrate = 9600
ser.open()
@JamoCA
JamoCA / UDF_isWebCEO.cfm
Created January 4, 2016 17:02
Identify WebCEO Bot Request - Block unwanted page requests from automated Competitor Metrics & Backlink Spy (They don't provide a way for sites to opt-out or use WebCEO-specific robots.txt rules.)
<cfscript>
/* 1/4/2016 Identify WebCEO Bot Request (https://www.webceo.com/webceo-bots.htm)
Block unwanted page requests from automated Competitor Metrics & Backlink Spy (They don't provide
a way for sites to opt-out or use WebCEO-specific robots.txt rules.)
*/
function isWebCEO(){
return YesNoFormat(ListFind("97.107.131.214,69.164.220.17,69.164.220.10,69.164.208.136,69.164.208.68,97.107.135.120,97.107.135.14,69.164.212.131,97.107.133.236,97.107.131.160", CGI.Remote_Addr) OR Findnocase("seo-audit-check-bot", CGI.http_User_Agent) OR Findnocase("online-webceo-bot", CGI.http_User_Agent));
}
</cfscript>
@mikesprague
mikesprague / set-cookie.cfm
Last active December 25, 2015 11:49
set cookie without cfcookie example (cfscript)
@fevangelou
fevangelou / default.vcl_PREFACE.md
Last active December 7, 2024 16:44
The perfect Varnish configuration for WordPress, Joomla, Drupal & other (common) CMS based websites

The perfect Varnish configuration for WordPress, Joomla, Drupal & other (common) CMS based websites

Updated on December 15th, 2021

IMPORTANT: Read this before implementing one of the configuration files below (for either Varnish 3.x or 4.x+).

USE: Replace the contents of the main Varnish configuration file located in /etc/varnish/default.vcl (root server access required - obviously) with the contents of the configuration you'll use (depending on your Varnish version) from the 2 examples provided below.

IMPORTANT: The following setup assumes a 180 sec (3 minute) cache time for cacheable content that does not have the correct cache-control HTTP headers. You can safely increase this to 300 sec (or more) for less busier sites or drop it to 60 sec or even 30 sec for high traffic sites. It obviously depends on your use case.

@danielantelo
danielantelo / microdata_resume_cv.html
Last active July 6, 2023 09:48
HTML5 Microdata Resume (Curriculum) Template
<!DOCTYPE html>
<html>
<head>
<!-- Meta conf -->
<meta charset="UTF-8">
<!-- Meta info -->
<title>HTML5 Microdata Resume (CV) Template</title>
<meta name="description" content="An example of how to layout a semantic html5 page for a curriculum vitae/resume">
<meta name="keywords" content="template, html, semantic, microdata, resume, cv, curriculum, vitae">
</head>
@JamoCA
JamoCA / ExifTool.cfc
Last active March 8, 2016 16:25
ColdFusion ExifTool.CFC update to enable gathering all metadata in a single call w/option to save result as JSON file.
<!---
@name: ExifTool.cfc
@originalauthor: Steven Erat
@originaldate: March 2011
@version: 1.0
@contact: [email protected], http://www.talkingtree.com/
@Forked: 9/17/2015 by James Moberg; http://SunStarMedia.com https://about.me/jamesmoberg
http://gamesover2600.tumblr.com/post/129293628174/exiftoolcfc-update
New getInfo() function to get a struct of all meta data.
Added logJSON option to save ExifTool JSON output to same filepath.