This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def determinant(matrix): | |
n = len(matrix) | |
if (n == 1): | |
return matrix[0][0] | |
else: | |
sum = 0 | |
for c in range(n): | |
sum += ((-1) ** c) * matrix[0][c] * \ | |
determinant([matrix[x][:c]+matrix[x][c+1:] for x in range(1, n)]) | |
return sum |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def list2Int(l): | |
n = 0 | |
for i in range(len(l)): | |
n += l[i] * (10 ** (len(l)-i-1)) | |
return n | |
def next_smaller(n): | |
n = list(str(n)) | |
n = [int(x) for x in n] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def snail(snail_map): | |
s = snail_map | |
n = len(s) | |
l = [] | |
if n > 1: | |
for i in range(n): | |
l.append(s[0][i]) | |
for i in range(1, n-1): | |
l.append(s[i][n-1]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from math import sqrt | |
def prime_factors(n): | |
s = "" | |
l = sorted(factorsList(n)) | |
l.append(-1) # this addintional element helps the last element in l to appear in s | |
# but itself won't appear in s | |
d = l[0] | |
i = 0 | |
for n in l: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GET https://thisartworkdoesnotexist.com/ | feh - --zoom max -B black |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build-v-tags | |
on: | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
latex-job: | |
runs-on: ubuntu-latest | |
name: Latex Job |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
response=`curl -s "http://c.ganjoor.net/beyt-json.php"` | |
m1=`echo $response | jq -r ".m1"` | |
m2=`echo $response | jq -r ".m2"` | |
poet=`echo $response | jq -r ".poet"` | |
# fribidi still monkeys with the output tho | |
echo -e "$m1\n$m2\n$poet" | fribidi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE UnicodeSyntax #-} | |
type Writer a = (a, String) | |
type CutMethod = [Integer] → [Integer] → [Integer] | |
type CutDiary = (CutMethod, Writer [Integer]) | |
return ∷ a → Writer a | |
return x = (x, "") | |
depthFirst ∷ CutMethod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
q=\' a='q=\\$q a=$q$a$q\; eval eval echo \$a'; eval eval echo $a |