Skip to content

Instantly share code, notes, and snippets.

@Happy-Ferret
Happy-Ferret / _ff-addon-snippet-gtkScreenshot.js
Created May 31, 2016 08:10 — forked from Noitidart/_ff-addon-snippet-gtkScreenshot.js
_ff-addon-snippet-gtkScreenshot - Takes screenshot of all monitors on on GTK systems. [jsctypes] [gtk] [gdk]
Cu.import('resource://gre/modules/ctypes.jsm');
var gdk2 = ctypes.open('libgdk-x11-2.0.so.0');
var _void = ctypes.void_t;
var gint = ctypes.int;
var GdkPixbuf = ctypes.StructType('GdkPixbuf');
var GdkDrawable = ctypes.StructType('GdkDrawable');
var GdkColormap = ctypes.StructType('GdkColormap');
var GdkWindow = ctypes.StructType('GdkWindow');
var guchar = ctypes.unsigned_char;
@Happy-Ferret
Happy-Ferret / _ff-addon-snippet-WinAPI_ShellExec.js
Created May 31, 2016 08:10 — forked from Noitidart/_ff-addon-snippet-WinAPI_ShellExec.js
_ff-addon-snippet-WinAPI_ShellExec - Launch things without waiting for response. [winapi] [jsctypes]
Cu.import('resource://gre/modules/ctypes.jsm')
var wintypesInit = function() {
var ifdef_UNICODE = true;
this.WINABI = ctypes.winapi_abi; //should do 64bit testing
// BASIC TYPES (ones that arent equal to something predefined by me)
this.BOOL = ctypes.bool;
this.CHAR = ctypes.char;
@Happy-Ferret
Happy-Ferret / libc_puts.js
Created June 1, 2016 18:42
Calling (g)libc's "puts()" from within javascript/js ctypes, writing a string to stdout.
/* import js-ctypes */
var {ctypes} = Components.utils.import("resource://gre/modules/ctypes.jsm", null);
/* Open the library */
try {
/* Linux */
var libc = ctypes.open("libc.so.6");
} catch (e) {
/* Most other Unixes */
libc = ctypes.open("libc.so");
@Happy-Ferret
Happy-Ferret / lolcat.hs
Created June 4, 2016 00:17 — forked from lest/lolcat.hs
simple lolcat powered by haskell
import Data.Word
freq = 0.3
spread = 8.0
unbase :: Integral int => int -> Word8 -> Word8 -> Word8 -> int
unbase base r g b = (fi r*base+fi g)*base+fi b
where fi = fromIntegral
-- | Approximate a 24-bit Rgb colour with a colour in the xterm256 6x6x6 colour cube, returning its index.
@Happy-Ferret
Happy-Ferret / README.md
Created June 6, 2016 06:42 — forked from oodavid/README.md
Deploy your site with git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
@Happy-Ferret
Happy-Ferret / ribbon.html
Created June 9, 2016 08:06
Github ribbon
http://terrenceryan.com/blog/index.php/github-ribbons-in-css/
@Happy-Ferret
Happy-Ferret / emoji_image_replace.js
Created June 9, 2016 09:40 — forked from mwunsch/emoji_image_replace.js
Detect emoji unicode on a page, replace it with images (supplied by GitHub, for now). Goes great in your ~/.js
/**
*
* Here's a thing that will look through all the text nodes of a document, and
* upon encountering an emoji codepoint, will replace it with an image.
* For now, those images are pulled from GitHub, which isn't very nice, so I
* need to find a more suitable host.
*
* Much of this code was gleaned from staring at the minified GitHub JS.
*
* Copyright (c) 2013 Mark Wunsch. Licensed under the MIT License.
@Happy-Ferret
Happy-Ferret / _ff-addon-snippet-EnumWindows.js
Created June 15, 2016 13:26 — forked from Noitidart/_ff-addon-snippet-EnumWindows.js
_ff-addon-snippet-EnumWindows - Using js-ctypes to try to do a EnumWindows with callback.
//https://github.com/nightwing/foximirror/blob/f40afb12beb512fb1d453afa028bc94c53f9326b/ctypes.picker.js#L8
Components.utils.import("resource://gre/modules/ctypes.jsm");
user32dll = ctypes.open('user32.dll');
var DWORD = ctypes.uint32_t;
var HANDLE = ctypes.size_t;
var HWND = HANDLE;
var BOOL = ctypes.bool;
var LPARAM = ctypes.size_t;
@Happy-Ferret
Happy-Ferret / README
Created June 27, 2016 09:56 — forked from bert/README
Embedding applications via XEmbed
From: gtk-list-bounces@gnome.org [mailto:gtk-list-bounces@gnome.org] On Behalf Of Andy Spencer
Sent: Friday, January 21, 2011 5:24 AM
To: Michael Treibton
Cc: gtk-list@gnome.org
Subject: Re: Embedding applications via XEmbed
On 2011-01-20 20:52, Michael Treibton wrote:
> I've read about GtkSocket and GtkPlug, but the examples for the
> official documentation don't make it clear to me how to go about this.
>
@Happy-Ferret
Happy-Ferret / taking screenshot in linux with C
Created June 27, 2016 18:42 — forked from bozdag/taking screenshot in linux with C
This C program takes the whole screenshot of the root window for a given display and saves it in PNG file format.
/*
Grabs a screenshot of the root window.
Usage : ./scr_tool <display> <output file>
Example : ./scr_tool :0 /path/to/output.png
Author: S Bozdag <selcuk.bozdag@gmail.com>
*/