Skip to content

Instantly share code, notes, and snippets.

View tacryt-socryp's full-sized avatar
🌊

tacryt-socryp tacryt-socryp

🌊
View GitHub Profile
@tacryt-socryp
tacryt-socryp / gist:9bdecfc7abbab3ed15c0
Created July 21, 2014 13:11
Website Scraper using PhantomJS
/* globals require, __dirname, console, process, setTimeout, document */
var phantom = require("phantom"),
system = require("system"),
jsdom = require("jsdom"),
fs = require("fs"),
saveDir = __dirname + "/snapshot",
url = require("url"),
ph;
@tacryt-socryp
tacryt-socryp / cookie-clicker.py
Created July 25, 2014 21:35
cookie-clicker for Google CodeJam
@tacryt-socryp
tacryt-socryp / magic-trick.py
Created July 25, 2014 21:36
magic-trick for Google CodeJam
f = open('A-small-attempt2.in', 'r')
T = f.readline()
y = 1
iterator = 0
for x in xrange(0,int(T)):
firstRow,secondRow = -6,-6
for i in xrange(0,10):
@tacryt-socryp
tacryt-socryp / touchID
Last active July 28, 2017 18:07 — forked from jstart/touchID
Touch ID Example
LAContext *myContext = [[LAContext alloc] init];
NSError *authError = nil;
if ([myContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&authError]) {
[myContext evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
localizedReason:@"Authenticate to access secure information"
reply:^(BOOL success, NSError *error) {
if (success) {
NSLog(@"User is authenticated successfully");
} else {
NSLog(@"Authentication Fails");
@tacryt-socryp
tacryt-socryp / blockstack-verification
Created September 4, 2017 03:10
Blockstack Verification
Verifying that "loganallenc.id" is my Blockstack ID. https://onename.com/loganallenc
@tacryt-socryp
tacryt-socryp / decrement.md
Created May 16, 2018 22:30
Decrement written in Hoon

Decrement

Write a gate that takes some integer n and returns (n - 1). You may not use dec from the Hoon stdlib, and you may not look at the code for dec in hoon.hoon. You're under the honor system.

@tacryt-socryp
tacryt-socryp / mylib.hoon
Created May 16, 2018 22:35
Subtraction written in Hoon
|%
++ new-dec
|= a/@
^- @
?: (lte a 0) ::
0
?: (lte a 1)
0
%- inner-dec :+(a 1 0)
@tacryt-socryp
tacryt-socryp / add-1.hoon
Last active May 16, 2018 22:42
Addition written in Hoon
/+ mylib :: import
=, mylib :: alias to the subject (don't have to type mylib anymore)
|= [a=@ b=@]
^- @
(new-add a b)
@tacryt-socryp
tacryt-socryp / mylib.hoon
Last active May 16, 2018 22:49
Prime number checker in Hoon
|%
++ new-prime
|= n=@
^- @
%- inner-prime [n 2]
++ inner-prime
|= a=[n=@ i=@] :: sample (input mold)
^- @ :: return mold
=+ upper=(div n.a 2) :: define a variable as the upper limit of variables to check = n/2
@tacryt-socryp
tacryt-socryp / fac-1.hoon
Last active May 16, 2018 22:52
Factorial Calculator with tail call optimization written in Hoon
/+ mylib :: import
=, mylib :: alias to the subject (don't have to type mylib anymore)
|= a=@
^- @
(new-fac a)