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 / isValidIPAddress_UDF.cfm
Created April 9, 2020 13:36 — forked from JamoCA/isValidIPAddress_UDF.cfm
ColdFusion UDF to test string to determine if valid IP address or not.
<!--- 20190801
ColdFusion UDF to test string to determine if valid IP address or not.
https://www.anujgakhar.com/2008/02/21/validate-ip-address-natively-with-coldfusion/ --->
<cfscript>
function isValidIPAddress(inputString){
var response = false;
var IPAddressUtils = createObject("java","coldfusion.util.IPAddressUtils");
response = javacast("boolean", IPAddressUtils.validateIPAdress( javacast("string", arguments.inputString) ));
if (response and listfind("0.0.0.0,255.255.255.255", javacast("string", arguments.inputString))){
@ivanionut
ivanionut / end of supervisord.conf
Created December 6, 2019 18:40 — forked from aubm/end of supervisord.conf
Sentry configuration files example
[program:sentry-web]
directory=/www/sentry/
command=/www/sentry/bin/sentry --config=/etc/sentry.conf.py start http
autostart=true
autorestart=true
redirect_stderr=true
[program:sentry-worker]
directory=/www/sentry/
command=/www/sentry/bin/sentry --config=/etc/sentry.conf.py celery worker -B
@ivanionut
ivanionut / my.cnf
Created June 4, 2019 20:22 — forked from fevangelou/my.cnf
Optimized my.cnf configuration for MySQL/MariaSQL (on cPanel/WHM servers)
# Optimized my.cnf configuration for MySQL/MariaSQL on cPanel/WHM servers
#
# by Fotis Evangelou, developer of Engintron (engintron.com)
#
# === Updated December 2018 ===
#
# The settings provided below are a starting point for a 2GB - 4GB RAM server with 2-4 CPU cores.
# If you have less or more resources available you should adjust accordingly to save CPU,
# RAM and disk I/O usage.
# The settings marked with a specific comment or the word "UPD" after the value
@ivanionut
ivanionut / faq.schema.org.json.html
Created May 8, 2019 11:42 — forked from walkergv/faq.schema.org.json.html
Frequently Asked Questions (FAQ) Pages Schema.org JSON-LD format
<!--When a JSON-LD document's top-level structure is an object that contains no other
properties than @graph and optionally @context (properties that are not mapped to an IRI
or a keyword are ignored), @graph is considered to express the otherwise implicit default graph.
This mechanism can be useful when a number of nodes exist at the document's top level that
share the same context, which is, e.g., the case when a document is flattened. The @graph
keyword collects such nodes in an array and allows the use of a shared context.
From https://www.w3.org/TR/json-ld/#h3_named-graphs
More on graph - http://stackoverflow.com/questions/30505796/json-ld-schema-org-multiple-video-image-page/30506476#30506476
pip freeze > requirements.txt
$ virtualenv <env_name>
$ source <env_name>/bin/activate
(<env_name>)$ pip install -r path/to/requirements.txt
<cfscript>
news = queryNew("id,type,title", "integer,varchar,varchar");
queryAddRow(news,[{
id: 1,
type: "book",
title: "Cloud Atlas"
},{
id: 2,
type: "book",
title: "Lord of The Rings"
@ivanionut
ivanionut / simple_authentication_rails_5_bcrypt_and_has_secure_password.md
Created January 13, 2019 12:48 — forked from iscott/simple_authentication_rails_5_bcrypt_and_has_secure_password.md
Cheat Sheet: Simple Authentication in Rails 5 with has_secure_password

Cheat Sheet: Simple Authentication in Rails 5 with has_secure_password

The goal of this cheatsheet is to make it easy to add hand-rolled authentication to any rails app in a series of layers.

First the simplest/core layers, then optional layers depending on which features/functionality you want.

Specs
AUTHOR Ira Herman
LANGUAGE/STACK Ruby on Rails Version 4 or 5
@ivanionut
ivanionut / routes.cfm
Created October 18, 2018 16:50
routes.cfm
<cfscript>
mapper()
.root(to="main##index", method="get")
.resources(name="products", path="products", nested=true)
.get(name="product", pattern="products/[key].html", to="products##show")
.root(to="products##index", method="get")
.end()
<cfscript>
num_iterations = 1*1000*10000;
// for()
for_start_time = getTickCount();
for(i=1; i<=num_iterations; i++);
for_end_time = getTickCount();
for_tot_time = for_end_time - for_start_time;
writeOutput("<br>for(): #for_tot_time#ms<br>");
<cfscript>
num_iterations = 1*1000*10000;
start_time = getTickCount();
for(i=1; i<=num_iterations; i++);
end_time = getTickCount();
tot_time = end_time - start_time;
writeOutput("#tot_time#ms");
</cfscript>