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
@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 / nginx.conf
Created August 19, 2018 12:08 — forked from igortik/nginx.conf
Nginx optimized configuration with DDoS mitigation
user nginx;
# one(1) worker or equal the number of _real_ cpu cores. 4=4 core cpu
worker_processes 4;
# renice workers to reduce priority compared to system processes for
# machine health. worst case nginx will get ~25% system resources at nice=15
worker_priority -5;
<cfscript>
function prettyPrintJSON (inputJSON) {
var engine = createObject("java","javax.script.ScriptEngineManager").init().getEngineByName("nashorn");
engine.eval("
function prettyPrintJSON (data) {
return JSON.stringify(JSON.parse(data), null, '\t');
}
");
return engine.invokeFunction("prettyPrintJSON", [inputJSON]);
}
<cfscript>
people = QueryNew( "name,dob,age", "varchar,date,int", [
[ "Susi", CreateDate( 1970, 1, 1 ), 0 ],
[ "Urs" , CreateDate( 1995, 1, 1 ), 0 ],
[ "Fred", CreateDate( 1960, 1, 1 ), 0 ],
[ "Jim" , CreateDate( 1988, 1, 1 ), 0 ]
]);
Dump( var=people, label="people - origional query" );
@ivanionut
ivanionut / ExampleQuery.cfm
Created June 3, 2018 16:24 — forked from mpadmore/ExampleQuery.cfm
Example of queryExecute
<cfscript>
people = queryNew(
"id, firstName, lastName, email, country, ip_address",
"integer, varchar, varchar, varchar, varchar, varchar",
[{
"id": 1,
"firstName": "Christopher",
"lastName": "Burton",
"email": "cburton0@disqus.com",
"country": "Poland",