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 / 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": "[email protected]",
"country": "Poland",
component output="false" displayname="SimplePGP" {
public SimplePGP function init(Required String config="PDS") {
variables.logger = application.logbox.getLogger(this);
switch(arguments.config) {
default: {
variables.publicKeyPath = expandPath('/path/to/key.pub');
@ivanionut
ivanionut / nova_sds011.py
Created November 19, 2017 18:10 — forked from marw/nova_sds011.py
Get reading from Nova PM Sensor SDS011 (dust sensor, air quality sensor, PM10, PM2,5) with sleep option
import time
import logging
try:
import serial
except ImportError:
print('Python serial library required, on Ubuntu/Debian: ' +
'apt-get install python-serial python3-serial')
raise
<!--- https://commons.apache.org/proper/commons-csv/apidocs/org/apache/commons/csv/package-summary.html --->
<cfset oCSV = createobject( "java", "org.apache.commons.csv.CSVFormat" )>
<cfset oParserObj = createobject( "java", "org.apache.commons.csv.CSVParser" )>
<cfdump var="#oParserObj#" expand="false">
<cfset oIOFile = createobject( "java", "java.io.File" ).init( expandpath( "./CLIENTIMPORT.csv" ) )>
<cfset oCharset = createobject( "java", "java.nio.charset.StandardCharsets" )>
<cfset oFormat = oCSV.EXCEL.withDelimiter( "|").withFirstRecordAsHeader().withQuote(javacast("char","")).withRecordSeparator("\r\n")>
<cfdump var="#oIOFile#" expand="false">
@ivanionut
ivanionut / nova_sensor.py
Created November 13, 2017 15:58 — forked from netmaniac/nova_sensor.py
Nova SDS011 sensor. Code is free to use in own projects, but I don't provide any support nor don't make me liable if it is not working :)
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import serial, time, struct, array
from datetime import datetime
ser = serial.Serial()
ser.port = "/dev/ttyUSB0" # Set this to your serial port
ser.baudrate = 9600
@ivanionut
ivanionut / sds011.py
Created October 23, 2017 09:23 — forked from jon1012/sds011.py
Read an SDS011 Laser PM2.5 Sensor (Nova PM Sensor) with Python
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import serial, time, struct
import httplib, urllib
ser = serial.Serial("/dev/ttyUSB0", baudrate=9600, stopbits=1, parity="N", timeout=2)
ser.flushInput()
@ivanionut
ivanionut / sds011.py
Created October 23, 2017 09:21 — forked from geoffwatts/sds011.py
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()
@ivanionut
ivanionut / isEmailDomainValid.cfm
Created September 7, 2017 08:21 — forked from JamoCA/isEmailDomainValid.cfm
ColdFusion UDF to validate if an email address' MX record exists. (Spammers tend to generate random domain strings when submitting comment spam.)
<!--- NOTE: This technique is not 100% accurate because some DNS servers don't allow MX queries or may be slow to respond,
but this will identify addresses that are potentially bad or suspicious. --->
<cfscript>
function isEmailDomainValid(email){
var local.email = arguments.email;
var local.DNSServer = '8.8.8.8'; /* Google DNS */
var local.timeout = 2000;
var local.attempts = 1;
var local.valid = true;
var local.emailDomain = trim(listlast(local.email,'@'));
@ivanionut
ivanionut / nginx-pagespeed.conf
Created June 26, 2017 20:22 — forked from rahul286/nginx-pagespeed.conf
nginx + pagespeed downstream caching example
#source: http://www.jefftk.com/2014-01-03--nginx.conf
# for debugging with valgrind
#daemon off;
#master_process off;
#user nobody;
worker_processes 1;
worker_rlimit_core 500M;
@ivanionut
ivanionut / ga_proxy.conf
Created May 18, 2017 20:03 — forked from 0xDing/ga_proxy.conf
Google Analytics Proxy
server {
listen 443 http2 ssl;
server_name analytics.example.com;
location /ga_proxy {
proxy_set_header X-real-ip $remote_addr;
rewrite ^/ga_proxy/(.*)$ /$1?$args&uip=$remote_addr;
proxy_pass http://www.google-analytics.com;
break;
}
location /analytics.js {