Skip to content

Instantly share code, notes, and snippets.

@DinisCruz
DinisCruz / first-version.cs
Last active November 10, 2019 21:04
Confirming which ASP.NET controls are vulnerable to XSS via the .Text propert
public static class HtmlControls_ExtensionMethods
{
public static string renderControl(this Control control)
{
var stringBuilder = new StringBuilder();
using (var stringWriter = new StringWriter(stringBuilder))
using (var htmlTextWriter = new HtmlTextWriter(stringWriter))
control.RenderControl(htmlTextWriter);
return stringBuilder.str();
@DinisCruz
DinisCruz / Github-network-graph.js
Created September 10, 2019 14:04
Show a better network graph
function hide(selector) { $(selector).setAttribute('style','display:none')}
function remove(selector) { $(selector).remove()}
function remove_class(selector) { $(selector).setAttribute('class','')}
function move_left(count)
{
var eventObj = document.createEvent("Events");
eventObj.initEvent("keydown", true, true);
eventObj.which = 37; // left key
for (i=0; i < count ; i++) {
@DinisCruz
DinisCruz / bokeh.py
Last active May 15, 2019 21:08
Jupyter OSBot-Commands
#https://bokeh.pydata.org/
#http://bokeh.pydata.org/en/latest/docs/installation.html
#https://nbviewer.jupyter.org/github/bokeh/bokeh-notebooks/blob/master/quickstart/quickstart.ipynb
!pip install bokeh
from bokeh.plotting import figure
from bokeh.io import output_notebook, show
output_notebook()
from numpy import cos, linspace
x = linspace(-6, 60, 1200)
@DinisCruz
DinisCruz / print-okrs.js
Created August 24, 2018 07:53
Jira JQuery filters
$('.jira-issues th').css({ 'min-width' : '100px' } )
$('#title-text').height(100)
$('.jira-issues th:nth-child(1)').css({'min-width': '700px'})
@DinisCruz
DinisCruz / Version 1 (with static data).cs
Last active October 26, 2017 21:09
O2 Script - Send data to Google Analytics via get request (of Image)
//descriptions from http://www.lunametrics.com/blog/2011/10/04/utmgif-request-parameters/
var utmwv = "5.3.8"; // Tracking code version
var utms = "1"; // Session requests. Updates every time a __utm.gif request is made. Stops incrementing at 500 (max number of GIF requests per session).
var utmn = "1797201820"; // Unique ID generated for each GIF request to prevent caching of the GIF image
var utmhn = "teammentor-33-ci"; // Host name, which is a URL-encoded string
var utmcs = "ISO-8859-1"; // Language encoding for the browser. Some browsers don’t set this, in which case it is set to “-”
var utmsr = "1440x852"; // Screen resolution
var utmvp = "1440x751"; // Size of Viewing Pane
var utmsc = "32-bit"; // Screen color depth
var utmul = "en-us"; // Browser language
@DinisCruz
DinisCruz / gulpfile.coffee
Created March 28, 2017 08:55
Simple gulp file to serve and watch Jekyll pages
browserSync = require('browser-sync').create();
gulp = require('gulp');
shell = require('gulp-shell');
gulp.task 'build', shell.task(['jekyll build --incremental'])
gulp.task 'reload-page', ['build'], -> browserSync.reload()
gulp.task 'default' , ['build'],->
@DinisCruz
DinisCruz / gist:1a5fbd548c15a7a6419366c8553f4837
Created January 8, 2017 22:30
Setup jenkins and GOGs on Docker
download docker
install docker (click cancel on the VirtualBox question)
on cmd.exe/sh
docker-machine create --driver=virtualbox default
docker-machine ssh default
docker run hello-world
docker run -it ubuntu bash
docker run -it -p 3000:3000 gogs/gogs
@DinisCruz
DinisCruz / SimpleVersion.xml
Last active December 26, 2016 08:59
Sample example of CustomDescriptionRule to be used on Fortify SCA
<?xml version="1.0" encoding="UTF-8"?>
<RulePack xmlns="xmlns://www.fortifysoftware.com/schema/rules">
<RulePackID>950F4B5A-85D0-4954-97D5-35C3F0285057</RulePackID>
<SKU>SKU-C:\Users\dinis\AppData\Local\Fortify\CRE-3.90\rules\custom-rule</SKU>
<Name>SimpleVersion-CustomDescriptionRule</Name>
<Version>1.0</Version>
<Description>
Description of RulePack
</Description>
<Rules version = "3.16">
@DinisCruz
DinisCruz / set-cert-pwd.sh
Created December 14, 2016 11:16
Script to set the pwd to use curl with an bbc cert (exported in OSX from KeyChain access)
#!/bin/bash
echo
echo "Note: run this using . ./set-cert-pwd.sh to set the variable in the host bash (it is expected that the bbc-cert.p12 is in the current path"
echo "What is the .p12 password: "
read -s pwd
export P12_PWD=$pwd
echo "The password has been set to the P12_PWD variable"
echo
@DinisCruz
DinisCruz / setup-maven.sh
Created December 5, 2016 14:25
Jenkins install automation scripts (to work as jenkins jobs)
cd ~/_tools
wget http://mirror.catn.com/pub/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
tar xzvf apache-maven-3.3.9-bin.tar.gz
echo "export PATH=~/_tools/apache-maven-3.3.9/bin:$PATH" >> ~/.bashrc