Skip to content

Instantly share code, notes, and snippets.

View vvzen's full-sized avatar
🎥
Pipeline Dev @ Apple, London 🇬🇧

Valerio Viperino vvzen

🎥
Pipeline Dev @ Apple, London 🇬🇧
View GitHub Profile
@nowl
nowl / perlin.lisp
Created February 16, 2011 01:55
Perlin Noise in Common Lisp (slightly optimized)
(defpackage #:perlin
(:use #:cl)
(:export #:perlin2d
#:*seed*))
(in-package #:perlin)
(declaim (optimize (speed 3) (safety 0) (debug 0)))
(defparameter *seed* 0)
@osdrv
osdrv / mercator.cpp
Created December 30, 2011 08:38
c++ libcinder mercator coordinates mapper
#include "Mercator.h"
#include "cinder/app/AppBasic.h"
#include "cinder/Vector.h"
using namespace ci;
using namespace std;
/* static method to map latitude and longitude to mercator 2d coords */
Vec2f Mercator::mapLatLon( const Vec2f lat_lon ) {
/* mercator projection center was screen centered */
Vec2f offset = Vec2f( app::getWindowWidth() / 2, app::getWindowHeight() / 2 );
@Integralist
Integralist / regex.js
Created March 11, 2013 15:15
The difference between JavaScript's `exec` and `match` methods is subtle but important, and I always forget...
var str = "The quick brown fox jumped over the box like an ox with a sox in its mouth";
str.match(/\w(ox)/g); // ["fox", "box", "sox"]
// match (when used with a 'g' flag) returns an Array with all matches found
// if you don't use the 'g' flag then it acts the same as the 'exec' method.
str.match(/\w(ox)/); // ["fox", "ox"]
/\w(ox)/.exec(str); // ["fox", "ox"]
@victorreyesh
victorreyesh / Aircrack Commands
Created September 12, 2013 03:36
Cracking WPA2 / WEP Wifi / Aircrack 10 seconds guide. For Mac OSX
//Install Macports.
//Install aircrack-ng:
sudo port install aircrack-ng
//Install the latest Xcode, with the Command Line Tools.
//Create the following symlink:
sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/sbin/airport
//Figure out which channel you need to sniff:
sudo airport -s
sudo airport en1 sniff [CHANNEL]
@voidtuxic
voidtuxic / metronome.cs
Created December 19, 2013 11:23
C# Metronome for Unity3D
using UnityEngine;
using System.Collections;
public delegate void MetronomeEvent(Metronome metronome);
public class Metronome : MonoBehaviour {
public int Base;
public int Step;
public float BPM;
public int CurrentStep = 1;
@draconiansolo
draconiansolo / Frame Padding
Last active January 29, 2020 10:37
Nuke tcl frame padding.
frame
[format "%04i" [frame]]
@tonymtz
tonymtz / gist:d75101d9bdf764c890ef
Last active May 7, 2024 13:07
Uninstall nodejs from OSX Yosemite
# first:
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
# To recap, the best way (I've found) to completely uninstall node + npm is to do the following:
# go to /usr/local/lib and delete any node and node_modules
cd /usr/local/lib
sudo rm -rf node*
@baku89
baku89 / OSX Example
Last active September 1, 2016 11:39 — forked from rc1/OSX Example
Command line arguments in openFrameworks
open -n ./emptyExampleDebug.app/ --args --myargs 1 2 3 4
"""
A simple example pyside app that demonstrates dragging and dropping
of files onto a GUI.
- This app allows dragging and dropping of an image file
that this then displayed in the GUI
- Alternatively an image can be loaded using the button
- This app includes a workaround for using pyside for dragging and dropping
@amirasaran
amirasaran / BaseThreading
Created October 27, 2016 06:36
Python threading with callback function (callback function run after thread is finished)
import time
import threading
class BaseThread(threading.Thread):
def __init__(self, callback=None, callback_args=None, *args, **kwargs):
target = kwargs.pop('target')
super(BaseThread, self).__init__(target=self.target_with_callback, *args, **kwargs)
self.callback = callback
self.method = target