Skip to content

Instantly share code, notes, and snippets.

@bond-
bond- / Main.java
Last active January 6, 2023 21:27
Mouse Mover to avoid screen going to autosleep
import java.awt.*;
import java.util.Random;
// For Mac devices accessibility needs to be turned on (in System Preferences) for the parent process that runs this program.
public class Main {
public static void main(String[] args) throws AWTException {
int min = 0;
GraphicsDevice defaultScreenDevice = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
int maxX = defaultScreenDevice.getDisplayMode().getWidth();
int maxY = defaultScreenDevice.getDisplayMode().getHeight();
@bond-
bond- / disable-eval-tampermoney.js
Last active September 21, 2020 09:22
Disable eval to get rid of annoying malware popups (Chrome PDF Viewer)
// ==UserScript==
// @name Disable eval to get rid of annoying malware popups
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match http*://*/*
// @exclude http*://*.google.com/*
// @run-at document-start
// @grant none
@bond-
bond- / progress-bar.groovy
Last active January 25, 2024 15:42
Command line progress bar in Groovy
int spaces = 20
int progress = 100
(progress + 1).times {
// String * int is a shortcut to repeat string that many times
String hash = "#" * Math.ceil((it*spaces)/100.0);
// Carraige return (\r) returns the cursor to first character in line, overwriting other characters
print(String.format("[%-" + spaces + "s] %d%s\r", hash, it, '%'))
@bond-
bond- / business-standard-anti-adblock.user.js
Created November 9, 2016 02:19
Tamper monkey script to override annoying adblock popup of business-standard
// ==UserScript==
// @name Business standard anti-adblock
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match http://www.business-standard.com/*
// @grant none
// ==/UserScript==
(function() {
@bond-
bond- / timesofindia.anti-adblock.user.js
Created November 9, 2016 01:21
Tamper monkey script to override annoying adblock popup of timesofindia
// ==UserScript==
// @name TOI Adblock pop-up override
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match http://*.indiatimes.com/*
// @grant none
// ==/UserScript==
@bond-
bond- / Yi-Home-README
Last active December 13, 2016 14:43
Yi Home app and firmware
Camera is great but finding app was difficult. Also, sharing what I did do the configuration right:
App:
- Download from Xiaomi market app from app.mi.com (http://app.mi.com/getAppstoreApkUrl)
- Login to market using Mi account
- In Xiaomi market app search for the string: 小蚁智能摄像机
- Download the first app from the store, It should show "Yi Home"
Firmware:
- Don't upgrade the firmware beyond 1.8.5.1L_201510301024
@bond-
bond- / CmdLine.R
Created October 7, 2015 13:27
Accepting command line arguments in R script
# A sample R script that accpets command line argumenst
args <- commandArgs(trailingOnly = TRUE)
print(args)
@bond-
bond- / XSDValidations.groovy
Last active December 14, 2015 21:19
XSDValidations.groovy
def xsdFiles = []
//create input stream for common xsd
def common = new StreamSource(new FileInputStream("common.xsd"))
xsdFiles.add(common)
def common1 = new StreamSource(new FileInputStream("common1.xsd"))
xsdFiles.add(common1).
.
.
def common100 = new StreamSource(new FileInputStream("common100.xsd"))
xsdFiles.add(common100)//here, common1...100.xsd are imported in sample.xsd. so, common1..100.xsd must be before sample.xsd