This file contains hidden or 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
| import sys | |
| from numpy import * | |
| from collections import Counter | |
| n = int(sys.argv[1]) | |
| def mat_fun(i,j): return (j == (i+1)%9) | ((i==6) & (j==0)) | |
| M = matrix(fromfunction(mat_fun, (9, 9)), dtype=int)**n | |
| ages=Counter(map(int,input().split(','))) | |
| sizes=array([ages[i] for i in range(9)]) | |
| print(M.dot(sizes).sum()) |
This file contains hidden or 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 asyncua import ua | |
| from asyncua.ua import ua_binary | |
| import sys | |
| import timeit | |
| obj = ua.WriteParameters(NodesToWrite=[ | |
| ua.WriteValue( | |
| NodeId_=ua.NodeId("hello_world"), | |
| Value=ua.DataValue( | |
| Value= |
This file contains hidden or 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
| ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGZ4MWfrK3MrBbfj+xP72A5Up2JT5p6pT9fv1UmNs4WF ophir-x1 |
This file contains hidden or 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
| package main | |
| import ( | |
| "compress/gzip" | |
| "context" | |
| "encoding/json" | |
| "fmt" | |
| "io" | |
| "log" | |
| "os" |
This file contains hidden or 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
| package main | |
| import ( | |
| "bufio" | |
| "compress/gzip" | |
| "fmt" | |
| "io" | |
| "log" | |
| "os" | |
| ) |
This file contains hidden or 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
| /** | |
| * This is a cloudflare worker for dezoomify | |
| */ | |
| /** | |
| * Respond to the request | |
| * @param {Request} request | |
| */ | |
| async function handleRequest(request) { |
This file contains hidden or 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
| use std::process::Command; | |
| use std::env; | |
| use std::process; | |
| use std::time::SystemTime; | |
| use crossbeam; // 0.7.3; | |
| pub fn main() { | |
| let myself = env::current_exe().expect("no current exe"); | |
| let n: u64 = env::args() | |
| .enumerate() |
This file contains hidden or 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
| WITH RECURSIVE | |
| -- First, we define the grid we are working on | |
| xaxis(x) AS (VALUES(-2.0) UNION ALL SELECT x+0.05 FROM xaxis WHERE x<0.5), | |
| yaxis(y) AS (VALUES(-1) UNION ALL SELECT y+0.1 FROM yaxis WHERE y<1), | |
| -- Then we compute the iterations of the mandelbrot function | |
| iterations(iter, cx, cy, x, y) AS ( -- one value per iteration step per point | |
| SELECT 0, x, y, 0.0, 0.0 FROM xaxis, yaxis -- c = cx + i * cy | |
| UNION ALL | |
| SELECT iter+1, cx, cy, x*x-y*y + cx, 2.0*x*y + cy -- z(iter+1) = z(iter)^2 + c. x=Re(z(iter+1)), y=Im(z(iter+1)) | |
| FROM iterations |
This file contains hidden or 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
| -- Computing the fibonaccci sequence in SQL | |
| -- Using a common table expression | |
| -- see: https://www.sqlite.org/lang_with.html | |
| with recursive fibonacci (n, current, next) as ( | |
| select 0, 0, 1 -- n=0, current=fibonacci(0)=0, next=fibonacci(1)=1 | |
| union all -- Using a recursive union between the fibonacci table and itself | |
| select n+1 as n, next, next+current -- n=n+1, current=next, next+=current | |
| from fibonacci | |
| ) |
This file contains hidden or 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
| use std::collections::BinaryHeap; | |
| use std::collections::HashSet; | |
| use std::cmp::Reverse; | |
| fn main() { | |
| println!("strict digraph {{"); | |
| let mut v : BinaryHeap<(Reverse<u128>, u8)> = Default::default(); | |
| let mut visited : HashSet<u128> = Default::default(); | |