Skip to content

Instantly share code, notes, and snippets.

@Happy-Ferret
Happy-Ferret / foo.cpp
Created October 16, 2015 06:36 — forked from NorioKobota/foo.cpp
exchange binary data between C++ and JavaScript by using linear-rpc - C++ part
/**
* $ git clone --recursive https://github.com/linaer-rpc/linear-cpp /path/to
* $ cd /path/to/linear-cpp
* $ ./bootstrap && ./configure && make
* $ cp /this/foo.cpp /path/to/linear-cpp/sample
* $ cd sample
* $ g++ -I ../include -I ../deps/msgpack/include -o foo foo.cpp ../src/.libs/liblinear.a ../deps/libtv/src/.libs/libtv.a ../deps/libtv/deps/libuv/.libs/libuv.a
* $ ./foo
*/
@Happy-Ferret
Happy-Ferret / Makefile
Created January 28, 2016 10:15 — forked from mietek/Makefile
Example Makefile for a Haskell project
all: test
ci: depclean test doc
PKG_DESCRIPTION = example.cabal
DEP = .cabal-sandbox
CONFIGURE = dist/setup-config
ifndef PREFIX
PREFIX = /usr/local
@Happy-Ferret
Happy-Ferret / sclg4.c
Created April 22, 2016 05:20 — forked from aktau/sclg4.c
A simple WinAPI GetAsyncKeyState()-based keylogger, written a very long time ago. I dug it out of the archives because of a Hacker News post (https://news.ycombinator.com/item?id=7607082). For educational purposes only, of course.
/**
* Copyright (c) 2006, Nicolas Hillegeer
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
@Happy-Ferret
Happy-Ferret / _ff-addon-snippet-X11_XChangeProperty.js
Created May 31, 2016 06:34 — forked from Noitidart/_ff-addon-snippet-X11_XChangeProperty.js
_ff-addon-snippet-X11_XChangeProperty - Changes the title of a window via _NET_WM_NAME. [jsctypes] [x11] [unix]
Cu.import('resource://gre/modules/ctypes.jsm')
var nixtypesInit = function() {
// BASIC TYPES (ones that arent equal to something predefined by me)
this.ATOM = ctypes.unsigned_long;
this.BOOL = ctypes.int;
this.CHAR = ctypes.char;
this.GDKDRAWABLE = ctypes.StructType('GdkDrawable');
this.GDKWINDOW = ctypes.StructType('GdkWindow');
this.DISPLAY = new ctypes.StructType('Display');
@Happy-Ferret
Happy-Ferret / _ff-addon-snippet-fuser_fread.js
Created May 31, 2016 08:06 — forked from Noitidart/_ff-addon-snippet-fuser_fread.js
_ff-addon-snippet-fuser_fread - trying to get fuser and fread from libc
Cu.import('resource://gre/modules/ctypes.jsm');
function doit() {
var _libc = ctypes.open('libc.so.6');
var _x11 = ctypes.open('libX11.so.6');
var popen = _x11.declare('popen', ctypes.default_abi, ctypes.voidptr_t, // Return int
ctypes.char.ptr, // Param1 const char *command
ctypes.char.ptr // Param1 const char *command
@Happy-Ferret
Happy-Ferret / _ff-addon-snippet-WinAPI-ShowWindowHide.js
Created May 31, 2016 08:10 — forked from Noitidart/_ff-addon-snippet-WinAPI-ShowWindowHide.js
_ff-addon-snippet-WinAPI-ShowWindowHide - Using js-ctypes and WinAPI method of ShowWindow to hide a window. [windows] [jsctypes]
Cu.import('resource://gre/modules/ctypes.jsm')
var wintypesInit = function() {
// BASIC TYPES (ones that arent equal to something predefined by me)
this.BOOL = ctypes.bool;
this.HWND = ctypes.voidptr_t;
this.INT = ctypes.int;
// CONSTANTS
this.SW_HIDE = 0;
@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 / 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/