Skip to content

Instantly share code, notes, and snippets.

View jevinskie's full-sized avatar

Jevin Sweval jevinskie

View GitHub Profile
@endolith
endolith / Readme.txt
Last active September 23, 2023 11:04
Gnome to Wine color scraper
This is a Python script to extract GNOME/GTK's color scheme and apply it to Wine, so that the themes (approximately) match.
Instructions:
1. Set your Gnome theme as you would like it
2. Run with a command like "python wine_colors_from_gtk.py"
3. Restart any apps running in Wine. They should match the Gnome theme colors now.
Better description with screenshots here: http://www.endolith.com/wordpress/2008/08/03/wine-colors/
This is also stored on https://code.launchpad.net/~endolith/+junk/wine-color-scraper
@copumpkin
copumpkin / gist:149443
Created July 18, 2009 06:32
Lots of iPhone protocols. Consider this BSD-licensed. I'd also appreciate if you made changes through the gist interface so I can see what you've done, but no pressure :)
# Very alpha still, but getting there...
# Yeah, I like it this way
require 'pp'
require 'set'
require 'zlib'
require 'base64'
require 'socket'
require 'openssl'
require 'stringio'
// a) As Mac OS X does not have byteswap.h
// needed this for a c util I had used over the years on linux.
// did not find a solution to stopgap via macports, sadly, but this did the trick
#if HAVE_BYTESWAP_H
#include <byteswap.h>
#else
#define bswap_16(value) \
((((value) & 0xff) << 8) | ((value) >> 8))
@mahmoudimus
mahmoudimus / python-monkey-patch-built-ins.py
Created February 4, 2010 22:20
pythonic monkey patching built-in types
# found this from Armin R. on Twitter, what a beautiful gem ;)
import ctypes
from types import DictProxyType, MethodType
# figure out side of _Py_ssize_t
if hasattr(ctypes.pythonapi, 'Py_InitModule4_64'):
_Py_ssize_t = ctypes.c_int64
else:
_Py_ssize_t = ctypes.c_int
@metaperl
metaperl / gForth examples improved
Created March 6, 2010 22:14
gForth examples improved
\ http://www.complang.tuwien.ac.at/forth/gforth/Docs-html/General-Loops-Tutorial.html
: halve-n ( n -- n/2 ) 2/ ;
: init-counter-for-number-of-halves-needed ( -- 0 ) 0 ;
: insure-n-is-greater-than-or-equal-to-0 ( n counter -- n counter flag )
over 0> ;
: halve-n-and-increment-counter { n counter -- n/2 counter+1 }
// DySlim is complicated and requires writing 6GB to disk (if only temporarily).
// This lets you mount the dyld shared cache via FUSE; the resulting files are weird but readable by things like otool and strings.
//
// gcc -std=gnu99 -I/opt/local/include -L/opt/local/lib -D_FILE_OFFSET_BITS=64 -o dsc dsc.c -lfuse -framework CoreFoundation
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <stdio.h>
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Here is a reference to the commit: http://codereview.chromium.org/659007
// [...]
void SetProcessName(CFStringRef process_name) {
if (!process_name || CFStringGetLength(process_name) == 0) {
NOTREACHED() << "SetProcessName given bad name.";
@rentalcustard
rentalcustard / 01_readme.markdown
Created October 25, 2010 11:20
Fix tmux bootstrap

The author of this patch is 'toby' from the MacPorts project, and the original commit containing this diff can be found at https://trac.macports.org/changeset/58563. The trac ticket prompting the commit (and with additional context) is at https://trac.macports.org/ticket/18357.

Toby, if you're reading this, apologies for not attributing the gist originally; I put this up quickly while experimenting with tmux under Leopard and abandoned it when it didn't solve the problem at hand. It's only fair now that other people are looking at the gist to give you credit.

@novi
novi / CoreFoundationOwnClassTest.c
Created October 28, 2010 08:39
Create your own CFType Class
// Created by Yusuke Ito, @novi_
#include <CoreFoundation/CoreFoundation.h>
#define UseCFHeader 0
#if UseCFHeader
#include "CFRuntime.h"
#else
0 --1-- 1 --1-- 2 --1-- 3
| \ | \ | \ |
| \ | \ | \ |
1 6 9 10 8 10 1
| \ | \ | \ |
| \ | \ | \ |
7 --5-- 6 --4-- 5 --8-- 4
\ / |
\ / |
10 11 1