Skip to content

Instantly share code, notes, and snippets.

View slabko's full-sized avatar

Andrew Slabko slabko

  • ClickHouse
  • Amsterdam, The Netherlands
View GitHub Profile
@slabko
slabko / index.html
Last active April 21, 2023 15:32
WebGL Example
<!doctype html>
<html>
<body>
<canvas width = "300" height = "300" id = "my_Canvas"></canvas>
<script>
/* Step1: Prepare the canvas and get WebGL context */
var canvas = document.getElementById('my_Canvas');
var gl = canvas.getContext('webgl2');
@slabko
slabko / quiz.py
Last active June 3, 2021 17:54
quiz
import random
import ion
import time
import kandinsky as ks
class Problem:
@classmethod
def generate_class(cls):
r = random.random()
@slabko
slabko / main.py
Last active March 18, 2018 05:53
asyncio without with bare hands
from itertools import islice
from collections import deque
from math import sqrt
import time
import asyncio
def lucas():
yield 2
a = 2
b = 1
@slabko
slabko / 0_reuse_code.js
Created October 16, 2016 20:12
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
(ns edge.transform)
(def test-matrix (repeat 9 [1 2 3 4 5 6 7 8 9]))
(defn- average-color [colors]
(let [s (sum colors)
])
(color 2))
(defn avg
@slabko
slabko / ScottEncoding
Created July 9, 2016 22:06
Scott Encoding
{-# LANGUAGE RankNTypes #-}
module ScottEncoding where
import Data.Monoid
data ListS a = ListS { uncons :: forall r. (a -> ListS a -> r) -> r -> r }
consS :: a -> ListS a -> ListS a
consS x xs = ListS (\f z -> f x xs)
@slabko
slabko / resign.sh
Created May 4, 2016 08:04
Change password of a p12 file
#!/bin/sh
# Usage resing.sh Input.p12 Output.p12
# Use at your own risk
echo 'Downloading Apple Root Certificate'
curl https://developer.apple.com/certificationauthority/AppleWWDRCA.cer > AppleWWDRCA.cer
echo 'Please enter original .p12 password'
openssl pkcs12 -in $1 -nocerts -out privateKey.pem -passout pass:qwert
@slabko
slabko / APN.hs
Last active September 27, 2015 22:02
Simple Apple Push Notification on Haskell
-- Big respect to author of the article Apple Push Notifications with Haskell
-- http://bravenewmethod.com/2012/11/08/apple-push-notifications-with-haskell/
-- It is actually the same code, simplified for my needs
module APN where
import qualified Data.ByteString as B
import qualified Data.ByteString.Char8 as BC
import qualified Data.ByteString.Lazy as BL
import qualified Data.ByteString.UTF8 as BU
@slabko
slabko / Remove imports.sh
Created May 1, 2015 10:25
Remove imports from .m and .h files
find ./ -name '*.h' -print -exec sed -i '' -E '/#\import \<UIKit\/UIKit.h\>/d' {} \;
find ./ -name '*.h' -print -exec sed -i '' -E '/#\import \<CoreData\/CoreData.h\>/d' {} \;
@slabko
slabko / RACCommand+ARLCompletedSignal.h
Last active September 27, 2016 08:01
RACCommand category for tracking completion
#import "RACCommand.h"
@interface RACCommand (ARLCompletedSignal)
@property (nonatomic, readonly) RACSignal *completed;
@end