Skip to content

Instantly share code, notes, and snippets.

@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);
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 {
@DinisCruz
DinisCruz / javap-test.java
Created Sep 5, 2016
Here is an experiment with javap to extract the methods programatically. It looks like javassit will be a better way to do this (specially since it is native)
View javap-test.java
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
/**
* Created by diniscruz on 01/09/2016.
*/
public class JavapHelper {
@DinisCruz
DinisCruz / 87-prettify-url-on-pop-under-window.js
Last active Nov 17, 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 / first-version.cs
Last active Nov 10, 2019
Confirming which ASP.NET controls are vulnerable to XSS via the .Text propert
View first-version.cs
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 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++) {
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 / 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'})
You can’t perform that action at this time.