Skip to content

Instantly share code, notes, and snippets.

View ivanionut's full-sized avatar
🎯
Focusing

Ivan Ionut ivanionut

🎯
Focusing
View GitHub Profile
@cecilemuller
cecilemuller / letsencrypt_2020.md
Last active January 9, 2025 12:22
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

@WebReflection
WebReflection / multiple-uploads.md
Last active June 30, 2021 14:12
Uploading multiple files at once, and without jQuery

The aim of this gist is to fix the following informative post about uploading via XHR.

Fixing the HTML

The first part is the HTML. First of all, you really don't need JavaScript to upload a file but you do need a proper form. Secondly, inputs in a form shouild have a name, because the name is what the server will receive: not IDs, names!

Following the fixed form part.

@hackerdem
hackerdem / check_link.py
Last active January 5, 2023 18:22
A simple python script to check broken links of a wesite
@aaronvanston
aaronvanston / form.html
Created May 7, 2016 11:01
Bootstrap 4 + Parsley JS
$("#parsleyForm").parsley({
errorClass: 'has-danger',
successClass: 'has-success',
classHandler: function(ParsleyField) {
return ParsleyField.$element.parents('.form-group');
},
errorsContainer: function(ParsleyField) {
return ParsleyField.$element.parents('.form-group');
},
errorsWrapper: '<span class="text-help">',
@walkergv
walkergv / faq.schema.org.json.html
Last active January 30, 2020 08:11
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
@igortik
igortik / nginx.conf
Last active April 3, 2025 18:55
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;
public void function onError(required any exception, required string eventname){
//log error
writeLog(file='[LOG FILE NAME]', text='#arguments.exception.message#');
//save error information in a single variable
savecontent variable='errortext' {
writeOutput("An error occurred: http://#cgi.server_name##cgi.script_name#?#cgi.query_string#<br />
Time: #now().dateFormat('short')# :: #now().timeFormat('short')#<br />");
writeDump(var=arguments.exception, label='Error Log');
writeDump(var=form, label='Form Scope');
@MilestoneTech
MilestoneTech / Application.cfc
Created February 24, 2016 04:01 — forked from christierney402/Application.cfc
CF: Using "Access-Control-Allow-Origin" header in ColdFusion CFScript #snippet
component {
boolean function onRequestStart( required string targetPage ) {
var headers = getHttpRequestData().headers;
var origin = '';
var PC = getpagecontext().getresponse();
// Find the Origin of the request
if( structKeyExists( headers, 'Origin' ) ) {
@JamoCA
JamoCA / Exiv2_UDF.cfm
Last active March 11, 2016 08:57
ColdFusion wrapper for Exiv2.exe (a command line utility to extract EXIF data). Much faster than ImageGetEXIFMetaData().
<!--- 2/16/2016 Exiv2(filePath, ExePath)
James Moberg - SunStar Media
Requires command-line version of Exiv2 http://www.exiv2.org/
All data returned in a struct. Based on filetype & metadata, keys may not always exist.
Latitude/Longitude keys w/decimal values added. All dates formatted to M/D/YYYY HH:MM:SS format.
Similar to ImageGetEXIFMetaData(imageNew( imageFilePath )), but much faster. (Exiv2 = 16-47ms; CF = 500-920ms)
--->
<cffunction name="Exiv2" returntype="struct" output="no">
<cfargument name="filepath" type="string" required="true">
<cfargument name="EXEpath" default="C:\Exiv2\Exiv2.exe" type="string" required="false">
@paulklinkenberg
paulklinkenberg / barcode4j.cfm
Created February 15, 2016 14:20
barcode4j example in CFML / Lucee
<cfset jarsPath = expandPath('/java/barcode4j/') />
<!--- Path where the necessary jar files are located (downloadable from https://www.dropbox.com/s/skl9fwky2n7mnjr/java-files-barcode4j.zip?dl=0) --->
<cfset libraryList = arrayToList( directoryList(jarsPath, false, 'array', '*.jar') ) />
<cfset configBuilder = createObject('java', 'org.apache.avalon.framework.configuration.DefaultConfigurationBuilder', libraryList) />
<cfset barcodeUtil = createObject('java', 'org.krysalis.barcode4j.BarcodeUtil', libraryList) />
<cfset grayImageType = createObject('java', 'java.awt.image.BufferedImage').TYPE_BYTE_GRAY />
<!--- create custom config. See http://barcode4j.sourceforge.net/2.1/symbol-ean-13.html --->
<cfset configXml = '<barcode>