Skip to content

Instantly share code, notes, and snippets.

View gf3's full-sized avatar
🍊
workin' goodly

Gianni Chiappetta gf3

🍊
workin' goodly
View GitHub Profile
@gf3
gf3 / Spotify.swift
Created August 29, 2017 20:55
Spotify ScriptingBridge from Swift
import AppKit
import ScriptingBridge
@objc public protocol SBObjectProtocol: NSObjectProtocol {
func get() -> Any!
}
@objc public protocol SBApplicationProtocol: SBObjectProtocol {
func activate()
var delegate: SBApplicationDelegate! { get set }
@gf3
gf3 / jsonp.js
Created June 18, 2009 18:18
Simple JSONP in vanilla JS
/**
* loadJSONP( url, hollaback [, context] ) -> Null
* - url (String): URL to data resource.
* - hollaback (Function): Function to call when data is successfully loaded,
* it receives one argument: the data.
* - context (Object): Context to invoke the hollaback function in.
*
* Load external data through a JSONP interface.
*
* ### Examples
@gf3
gf3 / email-test.js
Last active March 17, 2023 20:13
Validate and correct misspelled emails using a fuzzy matcher
/* eslint-env jasmine */
import { validate, suggest } from './email';
describe('email', () => {
describe('validate', () => {
it('should correctly validate correct email addresses', (done) => {
const promises = [
validate('user@gmail.com'),
validate('user+dix@host.ca'),
@gf3
gf3 / gist:306785
Created February 17, 2010 16:38
Sexy bash prompt
Moved to: http://github.com/gf3/dotfiles/blob/master/bash_prompt
@gf3
gf3 / boot options
Created May 27, 2020 03:03
Grub boot options (threadripper/nvidia)
mce=off blacklist=nouveau modprobe.blacklist=nouveau
@gf3
gf3 / env2yaml64.rb
Created September 10, 2021 18:29
Create the `data` part of a kubernetes opaque secret from an ENV file
require "base64"
require "dotenv"
require "yaml"
if ARGV.empty?
puts "Usage: #{__FILE__} <env file>"
exit 1
end
file = ARGV[0]
@gf3
gf3 / gist:328089
Created March 10, 2010 17:06
iTerm Colours
Black: 0, 0, 0
Red: 229, 34, 34
Green: 166, 227, 45
Yellow: 252, 149, 30
Blue: 196, 141, 255
Magenta: 250, 37, 115
Cyan: 103, 217, 240
White: 242, 242, 242
@gf3
gf3 / keybase.md
Last active April 13, 2021 17:28
keybase.md

Keybase proof

I hereby claim:

  • I am gf3 on github.
  • I am gf3 (https://keybase.io/gf3) on keybase.
  • I have a public key ASBSUcu3p7hJhvRo-yZRFSGw8dpcfC6SjR2A8PQHo84l1go

To claim this, I am signing this object:

@gf3
gf3 / iTunes.swift
Created August 29, 2017 18:50
iTunes ScriptingBridge from Swift
import AppKit
import ScriptingBridge
@objc public protocol SBObjectProtocol: NSObjectProtocol {
func get() -> Any!
}
@objc public protocol SBApplicationProtocol: SBObjectProtocol {
func activate()
var delegate: SBApplicationDelegate! { get set }
@gf3
gf3 / linked_list.c
Created April 20, 2010 18:25 — forked from Veejay/linked_list.c
Map in C
#include <stdio.h>
#include <stdlib.h>
struct node{
void* data;
struct node* next;
};
void set_int_value(struct node* node, int val)
{