Skip to content

Instantly share code, notes, and snippets.

@diosmosis
diosmosis / import-scheduler.controller.js
Last active November 7, 2019 23:58
import scheduler controller 2
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
(function () {
angular.module('piwikApp').controller('ImportSchedulerController', ImportSchedulerController);
@diosmosis
diosmosis / Tasks.php
Created November 7, 2019 23:48
temp gist 1
<?php
/**
* Piwik - free/libre analytics platform
*
* @link https://matomo.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
namespace Piwik\Plugins\GoogleAnalyticsImporter;
@diosmosis
diosmosis / PurgeOldArchiveData.php
Created March 5, 2015 01:37
command to force purges on archive tables for 2.11.2
<?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
namespace Piwik\Plugins\CoreAdminHome\Commands;
@diosmosis
diosmosis / gist:5073744
Last active December 14, 2015 10:39
perl script to create C++ header files using boost-style header layout. uses following input: project-name path-to-txt-file each line of path-to-txt-file is a path to a header, ie (boost\spirit\whatever\dooble.hpp). TODO: - make it ouput source files and create the config.hpp file (w/ DECL-ing) - only if its not header only - make it create jamf…
#!/usr/bin/perl
# Declare the subroutines
sub trim($);
sub ltrim($);
sub rtrim($);
# Perl trim function to remove whitespace from the start and end of the string
sub trim($)
{
@diosmosis
diosmosis / deleting.py
Created April 4, 2012 21:39
Deleting millions of rows from MySQL
import MySQLdb
rows_at_a_time = 100000
conn = # ...
cursor = conn.cursor()
while True:
cursor.execute("DELETE FROM mytable WHERE id < 2000000 LIMIT %d" % rows_at_a_time)
if cursor.rowcount < rows_at_a_time:
@diosmosis
diosmosis / app.scala
Created April 2, 2012 01:41
Scala Experiment Iteration 3
import scala.util.Random
import com.scalaiteration.router.Router
import com.scalaiteration.poker.game._
import com.scalaiteration.poker.players._
/** Testing singleton. */
object Test extends App {
val router = new Router(3)
val system = new PokerSystem(router)
@diosmosis
diosmosis / example.cpp
Created February 21, 2012 13:54
node-bind examples
#include <node-bind/node-bind.hpp>
struct MyType
{
MyType(int first_, int second_)
: first(first_)
, second(second_)
{}
std::string toString()
@diosmosis
diosmosis / example.js
Created February 19, 2012 12:10
jQuery-Render example
var books = ...; // do some ajax mumbo-jumbo
var booksTemplate =
'<div id="book_container">\
<% for (var k in books) { var bk = books[k]; %>\
<div id="id">\
<img src=\"<%= bk.pic %>\"/>\
</div>\
<div id="details">\
<span id="desc"><%= bk.desc %></span>\
@diosmosis
diosmosis / example.cpp
Created February 19, 2012 11:54
iris examples
// create a small GUI using mythos, the library iris will
// be a rewrite of
using namespace mythos;
namespace myapp
{
nyx::window mainframe;
std::string mloc_str(\"(MAX,MAX)\");
iris::event_handler extra;
@diosmosis
diosmosis / example.cpp
Created February 19, 2012 11:49
charmed examples
#include <iostream>
#include <string>
#include <boost/foreach.hpp>
#include <charmed/charmed.hpp>
// the attribute
struct operation_attribute
{
operation_attribute(std::string const& name_, std::string const& help_)
: name(name_), help(help_)