Skip to content

Instantly share code, notes, and snippets.

## Process this file with automake to produce Makefile.in
ACLOCAL_AMFLAGS = -I m4
AM_CPPFLAGS = $(FOO_CFLAGS)
lib_LTLIBRARIES = libfoo.la
libfoo_la_SOURCES = foobar.c foobar.h
libfoo_la_LIBADD = $(FOO_LIBS)
libfoo_la_LDFLAGS = -export-symbols-regex "^foo_"
@ptomato
ptomato / .jshintrc
Created April 26, 2014 00:17
My .jshintrc for GJS development
{
"esnext": true,
"evil": false,
"indent": 4,
"moz": true,
"multistr": true,
"sub": true,
"trailing": true,
"undef": true,
"predef": [
@ptomato
ptomato / clone.js
Created September 19, 2014 08:44
Clone a GObject
const Gtk = imports.gi.Gtk;
const GObject = imports.gi.GObject;
const Gir = imports.gi.GIRepository;
// G_PARAM_READWRITE is not yet properly introspected
const READWRITE = GObject.ParamFlags.READABLE | GObject.ParamFlags.WRITABLE;
const dontCloneTheseProperties = [
['Gtk', 'Widget', 'parent'], // would try to add the new widget to the same parent
['Gtk', 'Widget', 'margin'], // sets all margin properties at once
@ptomato
ptomato / gjsoverridesreader.js
Last active August 29, 2015 14:14
GJS overrides reader
const Gio = imports.gi.Gio;
let file = Gio.File.new_for_path(ARGV[0]);
let moduleName = file.get_basename().split('.')[0];
imports.searchPath.unshift(file.get_parent().get_path());
let module = imports[moduleName];
imports.searchPath.shift();
// Create missing parts of GObject-introspected API. Since we are importing the
V=0
VERBOSE = $(VERBOSE_$(V))
VERBOSE_0 = @echo " GEN $@";
VERBOSE_1 =
VIDEXT = webm
video_names = \
endless-01-desktop.m4v endless-08-offline.m4v \
endless-02-folders.m4v endless-09-writer.m4v \
<!DOCTYPE html>
<html lang="en" dir="ltr" class="client-nojs">
<head>
<meta charset="UTF-8" />
<title>American bullfrog - Wikipedia, the free encyclopedia</title>
<meta name="generator" content="MediaWiki 1.26wmf1" />
<link rel="alternate" href="android-app://org.wikipedia/http/en.m.wikipedia.org/wiki/American_bullfrog" />
<link rel="alternate" type="application/x-wiki" title="Edit this page" href="/w/index.php?title=American_bullfrog&amp;action=edit" />
<link rel="edit" title="Edit this page" href="/w/index.php?title=American_bullfrog&amp;action=edit" />
<link rel="apple-touch-icon" href="//bits.wikimedia.org/apple-touch/wikipedia.png" />
[
{
"playlist": [],
"machine_name": "math",
"subcategories": [
{
"playlist": [
{
"status": "0",
"vid": "Kf9KjCKmDcU",
@ptomato
ptomato / gist:2761283
Created May 21, 2012 08:55
Surface plasmon launch at a metal slit in Meep
(define-param slit? true) ; set to false to turn off the slit
(define a 1e-6) ;length unit used in simulation = 1 micron
(set! resolution 50) ;pixels per micron
(define size-x 7) ;microns
(define size-y 3) ;microns
(define wl 0.83) ;microns
(define pi 3.14159265358979)
(define c0 299792458) ; m/s
(define timesteps 150)
@ptomato
ptomato / zernike.py
Created May 25, 2012 18:19
Zernike aberrations
import numpy as N
import numpy.fft
from matplotlib import pyplot as P
npoints = 51 # odd number
side = N.linspace(-1, 1, npoints)
x, y = N.meshgrid(side, side)
r, theta = N.hypot(x, y), N.arctan2(y, x)
# Create a gaussian
@ptomato
ptomato / luminance.py
Created June 25, 2012 15:02
Luminance color scale
import numpy as N
import matplotlib.colors
def rotate(x, y, angle):
r, theta = N.sqrt(x ** 2 + y ** 2), N.arctan2(y, x)
theta += angle
return r * (N.cos(theta), N.sin(theta))