Skip to content

Instantly share code, notes, and snippets.

View claudiouzelac's full-sized avatar
🎯
Focusing

claudiouzelac

🎯
Focusing
View GitHub Profile
@claudiouzelac
claudiouzelac / azure_sql_maintaince_runbook.py
Last active January 23, 2019 21:09
azure_sql_maintaince_runbook.py
#!/usr/bin/env python2
import pyodbc
server = ${sql_name}
database =${sql_database}
username = ${sql_username}
password = ${sql_password}
driver= '{ODBC Driver 17 for SQL Server}'
cnxn = pyodbc.connect('DRIVER='+driver+';SERVER='+server+';PORT=1433;DATABASE='+database+';UID='+username+';PWD='+ password)
cursor = cnxn.cursor()
<# .SYNOPSIS Perform index maintenance .DESCRIPTION This runbook uses Azure Automation to perform reindexing and statistics maintenance of all databases on a target server. As prerequisite, please create an Azure Automation credential asset that contains the username and password for the target Azure SQL DB logical server ($SqlServerName). Make sure that you have installed the scripts IndexOptimize.sql, CommandLog.sql and CommandExecute.sql of Ola Hallengren (https://ola.hallengren.com/downloads.html) Make sure to get Ola's modified scripts which work on Azure here: https://ola.hallengren.com/downloads.html .EXAMPLE SQLServerIndexMaintenance .NOTES AUTHOR: Original author Pieter Vanhove: http://pietervanhove.azurewebsites.net/?p=14137 Heavily modified by Larry Silverman, CTO, TrackAbout Very slightly modified by Alexander Arvidsson: http://www.arcticdba.se #>
workflow AzureMaint
{
param (
# Credentials for $SqlServerName stored as an Azure Automation credential asset
# When using in th
@claudiouzelac
claudiouzelac / LocalStorage.java
Created January 17, 2019 20:37 — forked from roydekleijn/LocalStorage.java
Selenium WebDriver Javascript execution for localStorage
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
public class LocalStorage {
private JavascriptExecutor js;
public LocalStorage(WebDriver webDriver) {
this.js = (JavascriptExecutor) webDriver;
}
@claudiouzelac
claudiouzelac / cursed_mandelbrot.c
Created November 14, 2018 02:35 — forked from DavidBuchanan314/cursed_mandelbrot.c
Compile-time mandelbrot in pure C. Outputs a PGM image file to stdout.
#include <stdio.h>
#define SQ(x) (x)*(x)
#define M0(x,y) SQ(x)+SQ(y)<4?0:0xe0
#define M1(x,y,x0,y0) (SQ(x)+SQ(y)<4)?M0(SQ(x)-SQ(y)+(x0),2*(x)*(y)+(y0)):0xc0
#define M2(x,y,x0,y0) (SQ(x)+SQ(y)<4)?M1(SQ(x)-SQ(y)+(x0),2*(x)*(y)+(y0),x0,y0):0xa0
#define M3(x,y,x0,y0) (SQ(x)+SQ(y)<4)?M2(SQ(x)-SQ(y)+(x0),2*(x)*(y)+(y0),x0,y0):0x80
#define M4(x,y,x0,y0) (SQ(x)+SQ(y)<4)?M3(SQ(x)-SQ(y)+(x0),2*(x)*(y)+(y0),x0,y0):0x60
#define M5(x,y,x0,y0) (SQ(x)+SQ(y)<4)?M4(SQ(x)-SQ(y)+(x0),2*(x)*(y)+(y0),x0,y0):0x40
@claudiouzelac
claudiouzelac / callback_manager.h
Created November 12, 2018 11:29 — forked from daniel5151/callback_manager.h
Generic Callback Manager
#pragma once
#include <vector>
#include <cstddef>
/**
* Generic Callback Manager
*
* @tparam ...cb_args Types of callback arguments (aside from userdata)
*/
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import gdb
import operator
cs_instances = []
# This module helps generate a complete log of the call stack of a breakpoint.
# It can also record the value of some variables.
------------------------- MODULE GryadkaCasRegister -------------------------
EXTENDS Integers, Sequences, FiniteSets
-----------------------------------------------------------------------------
\* Timestamps is the set of possible timestamps for operations to choose from.
\* Each operation uses a unique timestamp.
\* Values is the set of possible values to set the register to.
\* Acceptors is the set of nodes which act as acceptors in the paxos sense.
\* Quorums is the set of all possible quorums, typically simple majorities.
CONSTANTS Timestamps, Values, Acceptors, Quorums
@claudiouzelac
claudiouzelac / TestJavaBasic.java
Created October 29, 2018 03:46 — forked from MMcM/TestJavaBasic.java
FoundationDB SQL Layer Java Routine Example
package com.foundationdb.example;
public class TestJavaBasic
{
public static void addSub(int x, int y, int[] sum, int[] diff) {
sum[0] = x + y;
diff[0] = x - y;
}
}
@claudiouzelac
claudiouzelac / README
Created September 8, 2018 12:51 — forked from tedhagos/README
My Latex Book Template
# Workflow and tool chain for writing a book for PDF publishing
## Toolchain
1. Pandoc, install using the cabal installer, don't apt-get. On OSX, there is dmg, I think the dmg is best option for OSX, it is just too problematic to get 1.9.2 cabal using brew or macports. There was one option I tried and succeeded, that is to install the Haskell environment using a package installer, that contained the cabal installer. Then install pandoc using cabal. Don't forget that the executables are in ~/.cabal/bin, so you have to set the path
2. TexLive, get the full distribution. It will take sometime to download, so get some coffee and be prepared to waste time
3. A good texteditor. ia Writer on OSX, vi (all around). Recently though, TextMate 2.0 Alpha seems to be a pretty good editor of Markdown
@claudiouzelac
claudiouzelac / config.md
Created September 7, 2018 17:41 — forked from 0xDE57/config.md
Firefox about:config privacy settings

ABOUT

about:config settings to harden the Firefox browser. Privacy and performance enhancements.
To change these settings type 'about:config' in the url bar. Then search the setting you would like to change and modify the value. Some settings may break certain websites from functioning and rendering normally. Some settings may also make firefox unstable.

I am not liable for any damages/loss of data.

Not all these changes are necessary and will be dependent upon your usage and hardware. Do some research on settings if you don't understand what they do. These settings are best combined with your standard privacy extensions (HTTPS Everywhere, NoScript/Request Policy, uBlock origin, agent spoofing, Privacy Badger etc), and all plugins set to "Ask To Activate".