Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Perceval Faramaz perfaram

🎯
Focusing
Block or report user

Report or block perfaram

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@perfaram
perfaram / Serial_input.au3
Last active Aug 29, 2015
(AutoIT) Creating licence key input box
View Serial_input.au3
#include <GUIConstantsEx.au3>
HotKeySet("{BACKSPACE}","_BackSpace")
Global $gui = GUICreate("...",600)
Global $Input = GUICtrlCreateInput("", 8, 150, 584, 35)
GUICtrlSetLimit($Input,29)
GUICtrlSetFont($Input,20)
Global $LastInput = ""
GUISetState()
Local $Temp, $LenPart = 5
@perfaram
perfaram / (SMC)stringRepFromVal.m
Last active Aug 29, 2015
Gets the string representation for a given SMCVal_t struct (as NSString).
View (SMC)stringRepFromVal.m
/**
* Gets the string representation for a given SMCVal_t struct (as NSString).
*/
-(BOOL) stringRepresentationFromVal:(SMCVal_t)val toString:(NSString**)abri
{
if (val.dataSize > 0) {
if ((strcmp(val.dataType, DATATYPE_UINT8) == 0) ||
(strcmp(val.dataType, DATATYPE_UINT16) == 0) ||
(strcmp(val.dataType, DATATYPE_UINT32) == 0))
*abri = [[NSString alloc] initWithFormat:@"%u", (unsigned int)[self _strtoul:(char *)val.bytes forSize:val.dataSize inBase:10]];
View KBCollectionExtensions.h
//
// KBCollectionExtensions.h
//
// Created by Guy English on 25/02/08.
// Copyright 2008 Kickingbear. All rights reserved.
//
#import <Cocoa/Cocoa.h>
/*
@perfaram
perfaram / checkerror.m
Created Jul 27, 2015
Function that extracts human-readable information from OSStatus codes.
View checkerror.m
//shamelessy taken from : https://github.com/Xcode-Snippets/Objective-C/blob/master/checkerror.m
static void CheckError(OSStatus error, const char *operation) {
if (error == noErr) {
return;
}
char str[20];
*(UInt32 *) (str + 1) = CFSwapInt32HostToBig(error);
if (isprint(str[1]) && isprint(str[2]) && isprint(str[3]) && isprint(str[4])) {
str[0] = str[5] = '\'';
View gist:ca3521ea832c69673bea
// Eric Wolfe: Added support for checking if mobile radios are enabled on the device
// Original source: http://www.enigmaticape.com/blog/determine-wifi-enabled-ios-one-weird-trick
#import <Foundation/Foundation.h>
#import <ifaddrs.h>
#import <net/if.h>
#import <SystemConfiguration/CaptiveNetwork.h>
@interface ERWNetworkStatus : NSObject
@perfaram
perfaram / semiprivate.md
Created Nov 21, 2015 — forked from tarcieri/semiprivate.md
Ed25519-based semi-private keys
View semiprivate.md

Semiprivate Keys

Semi-private keys are an expansion of the traditional idea of asymmetric keys, which have a public/private keypair, to N keys which can each represent a different capability level. In the degenerate case, a semi-private key system has 3 different types of keys. These are, to use the Tahoe terminology:

  • writecap: can publish new ciphertexts
  • readcap: can read/authenticate ciphertexts
View cltools.sh
#!/bin/sh
##
# Install autoconf, automake and libtool smoothly on Mac OS X.
# Newer versions of these libraries are available and may work better on OS X
#
# This script is originally from http://jsdelfino.blogspot.com.au/2012/08/autoconf-and-automake-on-mac-os-x.html
#
export build=~/devtools # or wherever you'd like to build
@perfaram
perfaram / Siriproxy_iTunes_play_track.rb
Last active Dec 24, 2015
Function which listen for a Siri command, catch the name of the track, then play it in iTunes.Part of a Siriproxy Plugin. French speaking required.
View Siriproxy_iTunes_play_track.rb
listen_for /Mac play (.*)/i do |play|
#Only for french speaking !!!
replacements = [ ["My", "Me"], ["col", "Call"], ["radiant", "Radian"] ]
replacements.each {|replacement| play.gsub!(replacement[0], replacement[1])}
#Only for french speaking !!! [End]
itunescheck = system("osascript -e 'if application \"iTunes\" is running then return 1'");
if play==nil then
say "Viva la musica !", spoken: "Vivaa la mousiica !"
View Swift - Dijkstra.swift
import UIKit
public class Vertex {
var key: String?
var neighbors: Array<Edge>
init() {
self.neighbors = Array<Edge>()
}
}
@perfaram
perfaram / encode_ascii_as_dna.py
Last active Jul 19, 2017
Encoding ASCII text as DNA (quaternary base)
View encode_ascii_as_dna.py
def to_base(n, bse):
digs = "0123456789abcdefghijklmnopqrstuvwxyz"
tmp = []
while n:
n, i = divmod(n, bse)
tmp.append(digs[i])
return "".join(tmp[::-1])
def chng_frm_base(s, frm_bse, to_bse):
if to_bse < 2 or to_bse > 36 or frm_bse < 2 or frm_bse > 36:
You can’t perform that action at this time.