Skip to content

Instantly share code, notes, and snippets.

Dinis Cruz DinisCruz

Block or report user

Report or block DinisCruz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Github-network-graph.js
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 / Github-network-graph.js
Created Sep 10, 2019
Show a better network graph
View Github-network-graph.js
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 / Vulnerability_Weak_Crypto.java
Created Sep 4, 2016
Java test that confirms how Random().nextInt() values can be predicted
View Vulnerability_Weak_Crypto.java
import org.junit.Test;
import java.util.ArrayList;
import java.util.Random;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
public class Vulnerability_Weak_Crypto {
View 1. poping a calculator on OSx using XMLGenerator XStream-based API.java
import java.io.IOException;
public class PoC_XMLGenerator
{
public static void main(String[] args) throws IOException
{
String process = "open";
String arguments = "/Applications/Calculator.app";
@DinisCruz
DinisCruz / bokeh.py
Last active May 15, 2019
Jupyter OSBot-Commands
View bokeh.py
#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 / 87-prettify-url-on-pop-under-window.js
Last active Apr 21, 2019
Misc Chrome extensions code snippets (to add to helper doc)
View 87-prettify-url-on-pop-under-window.js
url = 'http://127.0.0.1:4444/wd/hub/sessions'
options = { active:true, windowType:"normal", currentWindow: true }
chrome.tabs.query(options,function(tabs)
{
tabId = tabs[0].id
console.log(tabId)
chrome.tabs.update(tabId, {url: url})
chrome.tabs.executeScript(tabId, {file:'bower_components/jquery/dist/jquery.min.js'}, function()
@DinisCruz
DinisCruz / print-okrs.js
Created Aug 24, 2018
Jira JQuery filters
View print-okrs.js
$('.jira-issues th').css({ 'min-width' : '100px' } )
$('#title-text').height(100)
$('.jira-issues th:nth-child(1)').css({'min-width': '700px'})
@DinisCruz
DinisCruz / gist:3185313
Created Jul 26, 2012
VisualStudio VSIX: Adding an item to the ErrorList
View gist:3185313
var vsixPackage = O2_FluentSharp_VSIXPackage.vsixPackage; // this is a reference to an Package object
var ivsSolution = (IVsSolution)Package.GetGlobalService(typeof(IVsSolution));
var dte = (EnvDTE80.DTE2)Package.GetGlobalService(typeof(EnvDTE.DTE));
var errorListProvider = new ErrorListProvider(vsixPackage);
var errorText = "this is a test item";
var errorCategory = TaskErrorCategory.Error;
//Get first project details
var proj = dte.Solution.Projects.Item(1);
@DinisCruz
DinisCruz / Version 1 (with static data).cs
Last active Oct 26, 2017
O2 Script - Send data to Google Analytics via get request (of Image)
View Version 1 (with static data).cs
//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 Mar 28, 2017
Simple gulp file to serve and watch Jekyll pages
View gulpfile.coffee
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'],->
You can’t perform that action at this time.