Skip to content

Instantly share code, notes, and snippets.

Árpád Goretity  H2CO3

Block or report user

Report or block H2CO3

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:485eb9e0166863af928e790befb5a978
Add mypy type-checking cell magic to jupyter/ipython.
Save this script to your ipython profile's startup directory.
IPython's directories can be found via `ipython locate [profile]` to find the current ipython directory and ipython profile directory, respectively.
For example, this file could exist on a path like this on mac:
View ffff001.js
function getLargestArray(a, b) {
let as = => 'x').join('');
let bs = => 'x').join('');
let arx = new RegExp(as);
let brx = new RegExp(bs);
let aNotShorter = as.match(brx) !== null;
let bNotShorter = bs.match(arx) !== null;
let compare = aNotShorter - bNotShorter;
switch (compare) {
case -1: return b;
H2CO3 /
Created Dec 26, 2017
n-queens problem in Rust, with (some) reference counting
use std::rc::Rc;
#[derive(Copy, Clone)]
struct IntInt {
x: i32,
y: i32,
struct Cons<T: Copy> {
elt: T,
#include <vector>
#include <cstdio>
struct Node {
int value;
Node *next;
Node(int _value, Node *_next): value(_value), next(_next) {}
~Node() {
H2CO3 /
Created Oct 15, 2017
Protect against forgetting to call a test case evaluation function
fn make_test_evaluator() -> Box<Fn(YourTestCaseTypeHere)> {
use std::cell::RefCell;
struct EvalGuard(bool);
impl Drop for EvalGuard {
fn drop(&mut self) {
if !self.0 {
panic!("Did not actually evaluate test cases");
View Rust Impressions
- is functional
- but not pure, so you can printf-debug without IO() ALL THE FUNCTIONS
- has a strong Hindley-Milner type system
- but has convenient implicit coercions too, so you don't have to cast all over the place
- safe and high-level (with ownership, static/dynamic borrowing, Send and Sync)
- yet deterministic and fast with zero-/low-cost abstractions and RAII
- has a standard build system and dependency management
- but it doesn't force you to use it, and it has a simple Make-like CLI that doesn't hurt
- lets you write your code in the 'modern' IDE of your choice with all bells and whistles
View gist:71b4abcb6d66be58371c9ed5a0fdfa6a
Békésen ülök a Mammut KFC-ben, mellettem két, 24-28 éves forma lány. Egyikük hevesen ecseteli
a pasizás terén véghezvitt hőstetteit.
Sztori #1: Volt egy barátja, annak egy húga. A húgnak volt egy pasija. A csaj ezzel a csávóval jött össze,
még mielőtt a barátjával szakított volna, ezért hetekig titkolóztak – amit a leányzó láthatóan roppant humorosnak tartott.
Sztori #2: Nagyon büszke volt arra is, hogy ezután (meg előtt) volt pár egyéjszakás kalandja is. (vajon közben is voltak…?)
Sztori #3: 2 hónapig volt egy 20 éves (!!!) barátja, aki állítása szerint 16-ként viselkedett. De legalább vicces volt!
Úgy látszik, azt, hogy – idézem "mások előtt is képtelen volt normálisan viselkedni" –, ez teljesen jól ellensúlyozta.
Na, ezek után végre kifújta magát, így hagyta a másik lányt is szóhoz jutni, aki erre: "Jé, ez olyan érdekes! Nekem
View bmp.c
#include <stdio.h>
#include "bmp.h"
typedef struct __attribute__((packed)) {
uint16_t bfType; // specifies the file type
uint32_t bfSize; // specifies the size in bytes of the bitmap file
uint16_t bfReserved1; // reserved; must be 0
uint16_t bfReserved2; // reserved; must be 0
uint32_t bfOffBits; // species the offset in bytes from the bitmapfileheader to the bitmap bits
Learning TODO:
* Theoretical(-ish) Stuff:
- Computer Science, Algorithms, Data Structures (e.g. Finite Automata,
Classic Graph Algos, Searching and Sorting, Solutions to NP-Complete
Problems, Inventing and Using Heuristics, Complexity Theory in Depth,
You can’t perform that action at this time.