Skip to content

Instantly share code, notes, and snippets.

View danipolo's full-sized avatar

Dani Polo danipolo

View GitHub Profile
@JedIV
JedIV / conditional_scenario_run.py
Last active January 29, 2019 00:20
Checks the metrics of a dataset and conditionally runs a scenario
from dataiku.scenario import Scenario
import dataiku
### Set up objects
# The Scenario object is the main handle from which you initiate steps
scenario = Scenario()
# The Project that we'll be working with
# set up an api client
<?php
if ($curl = curl_init()) {
$hrefs = array(
'http://domain.com/page1.html',
'http://domain.com/page2.html',
'http://domain.com/page3.html',
'http://domain.com/page4.html',
'http://domain.com/page5.html',
);
foreach ($hrefs as $href) {
@stevenengland
stevenengland / Signal2Channel.mq4
Last active February 28, 2024 18:13
Sample implementation: How to send trading signals from Metatrader to Telegram channel/group/private chat with Telegram4MQL
//+------------------------------------------------------------------+
//| Signal2Channel.mq4 |
//| steven england |
//| https://Telegram4MQL.steven-england.info |
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| !!! Please note that there is a successor project. !!! |
//| Visit https://mmm.steven-england.info or |
//| https://github.com/stevenengland/MMM for more information |
@joe-dempsey
joe-dempsey / gist:38e4f9d848eacaba2f6562bc43e9652f
Created January 16, 2017 21:51
hreflang tags shopify liquid template
<link rel="alternate" hreflang="x-default" href="{{ canonical_url | replace: shop.domain, 'www.mystore.com' }}" />
<link rel="alternate" href="{{ canonical_url | replace: shop.domain, 'www.mystore.com' }}" hreflang="en-GB" />
<link rel="alternate" href="{{ canonical_url | replace: shop.domain, 'www.us.mystore.com' }}" hreflang="en-US" />
<link rel="alternate" href="{{ canonical_url | replace: shop.domain, 'www.mystore.com' }}" hreflang="en" />
<?php
echo "Running full GET requests... \n";
$sum = 0;
for( $i = 1; $i <= 100; ++$i ) {
$start = microtime(true);
@chipoglesby
chipoglesby / googleAnalyticsReporting.gs
Created June 2, 2016 15:40
Send your Google Analytics metrics and dimensions to Google Big Query using Google Apps Script.
//Replace xxx with your values as necessary.
function googleAnalyticsReporting() {
projectId = "xxx";
datasetId = "xxx";
tableId = 'xxx';
data = [];
yesterday = new Date();
yesterday.setDate(yesterday.getDate() - 1);
yesterday = Utilities.formatDate(yesterday, 'UTC', "yyyy-MM-dd");
@ctufts
ctufts / twitterStream_to_mysql.py
Last active July 8, 2019 01:37
The script creates a twitter stream listener using Tweepy then stores the data in a MySQL database. The code works with Python 3 and will also support emoji ( utf8mbr4 encoding ).
# code for streaming twitter to a mysql db
# for Python 3 and will support emoji characters (utf8mb4)
# based on the Python 2 code
# supplied by http://pythonprogramming.net/twitter-api-streaming-tweets-python-tutorial/
# for further information on how to use python 3, twitter's api, and
# mysql together visit: http://miningthedetails.com/blog/python/TwitterStreamsPythonMySQL/
from tweepy import Stream
from tweepy import OAuthHandler
@unmultimedio
unmultimedio / google-apps-script-calendar-sheets.js
Created August 11, 2015 20:09
Sync google sheets with google calendar. Create events from a spreadsheet.
// onOpen se ejecuta cada vez que se abre el documento (spreadsheet)
function onOpen() {
// Se obtiene el user interface
var ui = SpreadsheetApp.getUi();
// Se agregan las dos opciones del menú
ui.createMenu('Menu Calendario')
.addItem('Cargar Datos', 'setEventsFromCalendar')
.addSeparator()
.addItem('Limpiar Semana', 'clearWeek')
.addToUi();
@tinychaos42
tinychaos42 / cluster.php
Created January 17, 2012 21:24
The clustering algorithm
<?php
// no argument, process demo json
if(!isset($argv[1]))
{
$file = file_get_contents('data.json');
}
else
{
$file = file_get_contents($argv[1]);
}