- Lorem ipsum dolor {++sit ++}amet
- {++consectetur adipiscing elit++}
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
# https://www.reddit.com/r/askmath/comments/kic0id/uneven_probabilities/ | |
from collections import defaultdict | |
from functools import lru_cache | |
import math | |
import matplotlib.pyplot as plt | |
from pytablewriter import MarkdownTableWriter | |
PROB = { |
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
/* rendered css */ | |
.info { background-color: #eff4ff; padding: 25px; } | |
.info:before { content: "\f05a"; padding-right: 10px; } | |
.info:before { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; display: inline-block; font-style: normal; font-variant: normal; font-weight: normal; line-height: 1; } | |
.info:before { font-family: 'Font Awesome 5 Free'; font-weight: 900; } |
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 | |
set -u | |
git fetch --all --quiet | |
for b in $(git for-each-ref refs/heads --format="%(refname:short)"); do | |
if [[ ! $(git cherry -v origin/master $b | grep "^+") ]]; then | |
git branch -D $b | |
elif git diff --exit-code --quiet "origin/master...${b}"; then | |
git branch -D $b | |
fi |
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
#include <stdio.h> | |
#include <unistd.h> | |
int main() { | |
pid_t pid = fork(); | |
if (pid == 0) { | |
printf("I'm the child -- about to run ls -a -l\n"); | |
execlp("ls", "ls", "-a", "-l", (char*)NULL); | |
} else { | |
printf("I'm the parent -- about to run pwd\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
package main | |
import ( | |
"fmt" | |
"math/rand" | |
"reflect" | |
) | |
func worker(n int, ch chan int) { | |
count := rand.Intn(5) + 3 |
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
#include <stdio.h> | |
#include <stdlib.h> | |
typedef struct node { | |
int data; | |
struct node* next; | |
} node; | |
node* new_node() { | |
node* n = malloc(sizeof(node)); |
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
void renderText(TTF_Font* font, string text) { | |
SDL_Color color = {255, 0, 0}; | |
SDL_Surface* rendered = TTF_RenderText_Solid(font, text.c_str(), color); | |
// slightly modified from http://stackoverflow.com/questions/5289447/using-sdl-ttf-with-opengl | |
GLint colors = rendered->format->BytesPerPixel; | |
GLenum format; | |
if (colors == 4) { // alpha | |
if (rendered->format->Rmask == 0x000000ff) { | |
format = GL_RGBA; |
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
let start k = k [] | |
let push stack x k = k (x :: stack) | |
let pop (_ :: stack) k = k stack | |
let add (a :: b :: stack) k = k (a + b :: stack) | |
let stop (x :: _) = x |
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
#include <stdio.h> | |
#include <stdlib.h> | |
typedef struct { | |
int a; | |
} foo_t; | |
int main() { | |
foo_t *a; | |
a = calloc(10, sizeof(foo_t)); |
NewerOlder