Skip to content

Instantly share code, notes, and snippets.

View Nasawa's full-sized avatar

Christopher Johnson Nasawa

View GitHub Profile
@Nasawa
Nasawa / Cliptecho.js
Created November 5, 2016 22:36
Used in conjunction with Clipt, allows you to rapidly add games to Steam Big Picture Mode using keys (such as from Humble Bundle) copied on one computer and pasted on another.
var clip = require('copy-paste').global();
var socket = require('socket.io-client')(process.argv[2]);
var id = undefined;
if(process.argv[3])
id = process.argv[3];
socket.on('connect', function () { console.log("socket connected"); });
socket.on('id', function(i)
@Nasawa
Nasawa / userFriendlySMS.rb
Created July 29, 2016 19:05
Ruby program to send SMS e-mails
class SMS
require 'pony'
puts "Alright. This program will send people text messages throughout the day.\n"
puts "This is meant as a reminder, and I do not condone any malicious purposes.\n"
puts "If you have a negative impact on somebody's phone bill, I hope you go to court.\n"
puts "\nThat being said, I hope this is a useful tool for you!\n"
puts "Just follow these instructions and input valid information, and everything should work out.\n"
puts "Keep in mind that the messages are sent randomly, in no predictable order.\n"
@Nasawa
Nasawa / BackupApplication.java
Created July 29, 2016 15:22
Java application to backup a filesystem repeatedly over an interval of minutes
package backup;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.File;
@Nasawa
Nasawa / filesaver.js
Created July 29, 2016 15:02
JavaScript application to resize images
/*!
JSZip - A Javascript class for generating and reading zip files
<http://stuartk.com/jszip>
(c) 2009-2014 Stuart Knightley <stuart [at] stuartk.com>
Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/master/LICENSE.markdown.
JSZip uses the library pako released under the MIT license :
https://github.com/nodeca/pako/blob/master/LICENSE
@Nasawa
Nasawa / trimmer.py
Last active July 28, 2016 18:31
Trim image borders
import os
from PIL import Image, ImageChops
def trim(im):
bg = Image.new(im.mode, im.size, im.getpixel((0,0)))
diff = ImageChops.difference(im, bg)
diff = ImageChops.add(diff, diff, 2.0, -100)
bbox = diff.getbbox()
if bbox:
return im.crop(bbox)
@Nasawa
Nasawa / index.js
Created April 21, 2016 15:59
Hain Color Plugin
'use strict';
function h(c)
{
var r = parseInt(c[0]+c[1], 16);
var g = parseInt(c[2]+c[3], 16);
var b = parseInt(c[4]+c[5], 16);
return `rgb(${r}, ${g}, ${b})`.replace(/NaN/g, '0');
}
@Nasawa
Nasawa / index.js
Last active July 9, 2018 13:05
Experimental Hain plugin to quickly convert Timestamps
'use strict';
module.exports = (pluginContext) =>
{
function search(query, res)
{
var d = new Date(query * 1000);
res.add(
{
id: '1',
@Nasawa
Nasawa / app_.gitignore
Created February 14, 2016 08:34
Green Team app demo
/build
@Nasawa
Nasawa / BackupApplication.java
Created February 4, 2016 21:07
Backs up files from one folder to another
package backup;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.File;
@Nasawa
Nasawa / MatchFrames.java
Last active January 20, 2016 21:03
Finds matching frames and reports their timestamp
package videodiff;
import java.awt.image.BufferedImage;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.util.Vector;
import org.bytedeco.javacv.FFmpegFrameGrabber;