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(); | |
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 num::{Integer}; | |
| use std::ops::{MulAssign, DivAssign, AddAssign}; | |
| struct Collatz<T>(T); | |
| impl<T> Iterator for Collatz<T> | |
| where T: Integer + MulAssign + DivAssign + AddAssign + Clone, | |
| { | |
| type Item = T; | |
| fn next(&mut self) -> Option<T> { |
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
| public function on_complete_load_xml(param1:Event) : void | |
| { | |
| var _loc3_:* = undefined; | |
| var _loc4_:* = undefined; | |
| var _loc7_:* = undefined; | |
| var _loc8_:* = undefined; | |
| var _loc9_:* = undefined; | |
| var _loc10_:MovieClip = null; | |
| is_authorize_mainclip = true; | |
| var _loc2_:XML = new XML(param1.target.data); |
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
| Source | Emissions in grams per KWH | |
|---|---|---|
| BIOMASS | 230 | |
| FOSSIL_GAS | 490 | |
| FOSSIL_HARD_COAL | 820 | |
| FOSSIL_OIL | 820 | |
| HYDRO_PUMPED_STORAGE | 51 | |
| HYDRO_RUN_OF_RIVER_AND_POUNDAGE | 24 | |
| HYDRO_WATER_RESERVOIR | 24 | |
| SOLAR | 27 | |
| WASTE | 500 |
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 requests | |
| import re | |
| s = requests.Session() | |
| s.headers.update({'User-Agent': 'M'}) | |
| for n in range(91563, 91563+1000): | |
| u = f'https://regards.monuments-nationaux.fr/fr/asset/id/{n}/x/idFeatureFrom/798/thumbIndex/0/mosaicCount/177/ajax/1/format/json' | |
| h = s.get(u).json()['html'] | |
| title = re.search('<h1 title="([^"]+)"', h).group(1) |
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::fmt::Debug; | |
| #[derive(Debug)] | |
| struct S { | |
| x: Option<u32>, | |
| y: u32, | |
| } | |
| /// Generates a funtion named $field the returns the existing value for | |
| /// $field in self if it's not None, and otherwise computes it in |
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
| """ | |
| Solution to https://gist.github.com/lovasoa/a4efdd4f30cc0ee4cd9f0563fb7ec64e | |
| execute with: | |
| mkfifo fifo | |
| python3 crack.py < fifo | python3 challenge.py | tee fifo | |
| """ | |
| password = "" | |
| for i in range(64): |
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
| function exec(a,b){ | |
| let pgm = document.body.innerText.split(',').map(x=>parseInt(x)); | |
| pgm[1] = a; pgm[2] = b; | |
| for(let p=0; ; p+= 4){ | |
| if(pgm[p]==1) pgm[pgm[p+3]] = pgm[pgm[p+1]] + pgm[pgm[p+2]]; | |
| else if(pgm[p]==2) pgm[pgm[p+3]] = pgm[pgm[p+1]] * pgm[pgm[p+2]]; | |
| else if(pgm[p]==99) break; | |
| else throw new Error("invalid opcode "+pgm[p]); | |
| } | |
| return pgm[0]; |