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> | |
#define IS_DIGIT(C) ((C) >= '0' && (C) <= '9') | |
int main() | |
{ | |
int i = 0, n = 0; | |
char *s = "a!b+c(75"; // two digits, right? | |
while (s[i] != '\0') { |
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
:- use_module(library(clpfd)). | |
points(1, 25). | |
points(2, 18). | |
points(3, 15). | |
points(4, 12). | |
points(5, 10). | |
points(6, 8). | |
points(7, 6). | |
points(8, 4). |
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 encodings.aliases import aliases | |
for a in aliases: | |
try: | |
print('ö'.encode('utf-8').decode(a), a) | |
except: | |
pass |
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
# sample usage: | |
# $ cd /home/paedu/c | |
# $ virgp stdio | |
function virgp { | |
files="$(rg -l $1 | tr '\n' ' ')" | |
if [ -z "$files" ] | |
then | |
echo "pattern $1 did not match any files" | |
else | |
#echo "vim -p ${files}" |
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
#!/usr/bin/env python3 | |
# Object-Oriented Programming: | |
# - verbose | |
# - mutable state | |
class Rounding: | |
def __init__(self, granularity): | |
self._granularity = granularity |
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
:- use_module(library(clpr)). | |
alice(apple, 1). | |
alice(banana, 2). | |
alice(orange, 3). | |
alice(kiwi, 4). | |
bob(apple, 1). | |
bob(orange, 2). | |
bob(banana, 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
package main | |
import "fmt" | |
type Numeric interface { | |
~int | ~float32 | ~float64 | |
} | |
type Predicate[T any] func(T) bool | |
type Transform[T any] func(T) T |
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
#!/usr/bin/env python3 | |
from datetime import datetime | |
import re | |
import requests | |
import sys | |
def get_forum_text(forum_id): | |
url = f'https://debianforum.de/forum/viewforum.php?f={forum_id}' |
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" | |
type Numeric interface { | |
~int | ~float32 | ~float64 | |
} | |
type Predicate[T any] func(T) bool | |
type Transform[T any] func(T) T |
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
program p() { | |
while (halts(p) { | |
p(); | |
} | |
} |
OlderNewer