Skip to content

Instantly share code, notes, and snippets.

@zarak
zarak / Makefile
Created May 17, 2023 23:50 — forked from ecnerwala/Makefile
Competitive Programming Makefile
# +--------------------+
# | |
# | GENERAL CONFIG |
# | |
# +--------------------+
PROBLEM_NAME := problem_name
DEBUG := true
LANG := cpp
import torch
import timeit
# Globals
torch.set_default_tensor_type(torch.DoubleTensor)
m = 1000
n = 10
# NUMBER_OF_RUNS = int(1e6)
#include <iostream>
using namespace std;
void getInput(double arr[][2], int n) {
cout << "number of employees before loop: " << n << endl;
for (int i = 0; i < n; i++) {
cout << "employee " << i << " = ";
cin >> arr[i][0];
}
cout << "number of employees after loop: " << n << endl;
{ pkgs ? import <nixpkgs> {} }:
let
compilers = with pkgs; {
gcc8 = overrideCC stdenv gcc8;
};
in
compilers.gcc8.mkDerivation {
name = "env";

Keybase proof

I hereby claim:

  • I am zarak on github.
  • I am zarak (https://keybase.io/zarak) on keybase.
  • I have a public key ASBXvCzDq4Tc6z5AdHRLSjIeNijKBAsOdIWOSnd-O2ZDzQo

To claim this, I am signing this object:

@zarak
zarak / editor.hs
Last active April 16, 2021 09:51
JSON decoding error in Plutus Playground
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE DeriveAnyClass #-}
@zarak
zarak / tex.snippets
Last active June 12, 2021 04:38
TeX snippets
global !p
texMathZones = ['texMathZone' + x for x in ['A', 'AS', 'B', 'BS', 'C', 'CS', 'D', 'DS', 'E', 'ES', 'F', 'FS', 'G', 'GS', 'H', 'HS', 'I', 'IS', 'J', 'JS', 'K', 'KS', 'L', 'LS', 'DS', 'V', 'W', 'X', 'Y', 'Z', 'AmsA', 'AmsB', 'AmsC', 'AmsD', 'AmsE', 'AmsF', 'AmsG', 'AmsAS', 'AmsBS', 'AmsCS', 'AmsDS', 'AmsES', 'AmsFS', 'AmsGS' ]]
texIgnoreMathZones = ['texMathText']
texMathZoneIds = vim.eval('map('+str(texMathZones)+", 'hlID(v:val)')")
texIgnoreMathZoneIds = vim.eval('map('+str(texIgnoreMathZones)+", 'hlID(v:val)')")
ignore = texIgnoreMathZoneIds[0]
module Test.MySolutions where
import Prelude
import Data.Foldable (traverse_)
import Data.Int (even)
import Data.Monoid (power)
import Data.Monoid.Additive (Additive (..))
import Data.String.CodeUnits (toCharArray)
import Data.Traversable (sequence)
import Data.Tuple (Tuple(..))
{ pkgs ? import (fetchTarball https://github.com/nixos/nixpkgs/archive/nixpkgs-unstable.tar.gz) {} }:
#pkgs.mkShell {
#buildInputs = [ pkgs.python37 ];
#}
let customPython = pkgs.python37.buildEnv.override {
extraLibs = [];
};
in
@zarak
zarak / Lib.hs
Last active August 4, 2020 06:21
module Lib where
import Data.Map
-- Types
type IntegerTerm = Term Integer Integer
newtype Exponent e =
Exponent e
deriving (Eq, Ord, Show)