Skip to content

Instantly share code, notes, and snippets.

@davidsf
davidsf / get_all_versions.sh
Last active October 8, 2020 16:32
Get all versions of a file in a repo
#!/bin/bash
# we'll write all git versions of the file to this folder:
EXPORT_TO=/tmp/all_versions_exported
# take relative path to the file to inspect
GIT_PATH_TO_FILE=$1
# ---------------- don't edit below this line --------------
@davidsf
davidsf / gist:8c8a01341e7acceaf7d8855427c6c74b
Created January 30, 2020 17:11
Downgrade java version
apt-get purge openjdk-8-jre-headless
wget https://launchpad.net/~openjdk-r/+archive/ubuntu/security-deletedppa/+build/16691000/+files/openjdk-8-jre-headless_8u212-b03-0ubuntu1.16.04.1_amd64.deb
apt-get install ca-certificates-java
dpkg -i openjdk-8-jre-headless_8u212-b03-0ubuntu1.16.04.1_amd64.deb
@davidsf
davidsf / gist:5247895720da5754133b8a5b6279b94e
Created March 20, 2019 08:29
Name collision handlers vs model
handlers/product.cfc:
component{
function index( event, rc, prc ){
prc.product = EntityLoadByPk( 'product', 1);
dump(prc.product.user_id );
}
}
"query": {
"filtered": {
"query": {
"bool": {
"must": [
{
"query_string": {
"default_field": "titulo",
"query": "malaga cromo",
"default_operator": "and"
"query": {
"bool": {
"should": [
{
"multi_match": {
"query": "malaga cromo",
"fields": [
"titulo"
],
"operator": "and"
// ORMSettings: flushatrequestend = false, automanagesession = false
// No errors, just obj.myprop not populate to db:
obj = cacheget(tag);
entityMerge(obj);
transaction {
obj.myprop = 'example';
}
12ms
13ms
12ms
11ms
11ms
10ms
20ms
11ms
12ms
12ms
@davidsf
davidsf / gist:5859062
Last active December 18, 2015 23:08
SqlServer Json River
{
"type":"jdbc",
"jdbc": {
"driver":"com.microsoft.sqlserver.jdbc.SQLServerDriver",
"url":"jdbc:sqlserver://ipaddress:port;databaseName=mydatabase",
"user":"myuser","password":"mypass",
"sql":"select * from table",
"poll":"30s"
},
"index": {
<cfquery name="en_memoria" datasource="venvir">
SELECT * FROM Memoria WHERE Id_Lote = #datos_para_gateway.num_lote# AND URL_TOKEN = '#datos_para_gateway.usr_token#'
</cfquery>
<cfif #en_memoria.RecordCount# EQ 0>
<cfquery name="memoria" datasource="venvir">
INSERT INTO Memoria (Id_Lote, URL_Token, Fecha) VALUES (#datos_para_gateway.num_lote#, '#datos_para_gateway.usr_token#', #now()#);
</cfquery>
<cfelse>
<cfquery name="memoria" datasource="venvir">
UPDATE Memoria
@davidsf
davidsf / gist:3134646
Created July 18, 2012 06:43
Railo performance
Command: ab -n 10 url
Production Site - IIS 6.0 + Coldfusion 8.0
Requests per second: 3.98 [#/sec] (mean)
Time per request: 251.330 [ms] (mean)
Connection Times (ms)
min mean[+/-sd] median max
Connect: 44 52 11.4 48 79