Skip to content

Instantly share code, notes, and snippets.

View tekul's full-sized avatar
🦥
🐑

tekul

🦥
🐑
View GitHub Profile
@tekul
tekul / coverage_report.sh
Created April 15, 2022 17:28
Rust code coverage script
#!/bin/bash
#
# Prerequisites:
# rustup component add llvm-tools-preview
# cargo install rustfilt
# jq
set -euo pipefail
TOOLS_DIR="$(rustc --print sysroot)/lib/rustlib/x86_64-unknown-linux-gnu/bin"
@tekul
tekul / arrayFilter.js
Last active January 20, 2022 21:01
CYF filter and forEach discussion
// We start with an array of pet objects
let pets = [
{
name: "Hector",
type: "dog",
likes: "chicken"
},
{
name: "Mackie",
type: "cat",
@tekul
tekul / arrayMap.js
Last active July 15, 2021 20:36
CYF array.map discussion
// We want to apply a function to each element of an array and get
// back a new array of the same length, with a function applied to
// each element.
let arr = [1, 2, 3, 4, 5];
console.log(arr);
// Then function takes one parameter (same type as the elements in
// the array) and has to return something (or we end up with an
@tekul
tekul / top_users.js
Created April 3, 2020 01:22
Identify top users/purchases
function idBestUsers() {
let monthlyOrders = [...arguments];
let totalMonths = monthlyOrders.length;
let clientOrders = new Object();
monthlyOrders[0].forEach(clientId => {
if(!clientOrders[clientId]) {
clientOrders[clientId] = new Array(monthlyOrders.length);
clientOrders[clientId][0] = 0;
@tekul
tekul / wdtest.hs
Created February 27, 2018 21:09
WebDriver doCommand customization
{-# LANGUAGE OverloadedStrings, FlexibleContexts, MultiParamTypeClasses, TypeFamilies, UndecidableInstances, GeneralizedNewtypeDeriving #-}
import Control.Monad.Base (MonadBase, liftBase)
import Control.Monad.Trans.Control (MonadBaseControl(..), StM)
import Control.Monad.Catch (MonadThrow, MonadCatch)
import Control.Exception.Base (fromException, SomeException(..))
import Control.Exception.Lifted (throwIO, catch)
import Control.Monad.IO.Class
import Control.Monad.Fix
import Control.Monad.Trans.State.Strict (StateT, get, put)
@tekul
tekul / keywrap.hs
Last active February 7, 2016 15:45
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Main where
import Criterion.Main
import Control.Monad.State
import Crypto.Error
import Crypto.Cipher.AES
import Crypto.Cipher.Types

Keybase proof

I hereby claim:

  • I am tekul on github.
  • I am tekul (https://keybase.io/tekul) on keybase.
  • I have a public key whose fingerprint is DA49 35C1 2444 4710 F7D7 A289 CE5E 7562 B9D2 9BD2

To claim this, I am signing this object:

@tekul
tekul / GatlingPlugin.scala
Created March 29, 2012 21:31
Gatling SBT Plugin
import sbt._
import Keys._
object GatlingPlugin {
val gatling = TaskKey[Unit]("gatling")
val gatlingVersion = SettingKey[String]("gatling-version")
val gatlingResultsDirectory = SettingKey[String]("gatling-results-directory")
val gatlingDataDirectory = SettingKey[String]("gatling-data-directory")
val gatlingConfigFile = SettingKey[String]("gatling-config-file")