Operator | Description | Example |
---|---|---|
= | is equal to | [ $a = $b ] |
== | is equal to | [ $a == $b ] |
!= | is not equal to | [ $a != $b ] |
> | is greater than, in alphabetical order | [ $a > $b ] |
< | is less than, in alphabetical order | [ $a < $b ] |
-z | has zero length | [ -z $a ] |
-n | has non-zero length | [ -n $a ] |
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
#ifndef VECTOR_H | |
#define VECTOR_H | |
#include <stdint.h> | |
#include <stddef.h> | |
#include <malloc.h> | |
#define VECTOR(_type) VECTOR_##_type##_t | |
#define VECTOR_INIT(_type, _vec) VECTOR_##_type##init(_vec) | |
#define VECTOR_FREE(_type, _vec) VECTOR_##_type##free(_vec) |
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
#ifndef _LAMBDA_H | |
#define _LAMBDA_H | |
#define LAMBDA(stmt, ret, ... /*args*/) \ | |
({ ret __fun__(__VA_ARGS__) { stmt; }; __fun__; }) | |
#endif |
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
/* Naive implementation of string (char *) to int conversion in ISO C. */ | |
int | |
strtoi(const char *str, unsigned int len) | |
{ | |
int i, neg, num; | |
unsigned int val, pow; | |
if (str == 0 || len == 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
/* ascii.c -- print the integer value of the given ascii chars */ | |
/* | |
compilation: | |
cc ascii.c -o ascii | |
usage: | |
ascii your characters here [...] | |
*/ |
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
pub fn main() { | |
// collect the command line arguments into a vector of string | |
let mut argv: Vec<String> = std::env::args().collect(); | |
// if no arguments are given assume the current directory | |
if argv.len() < 2 { | |
argv.push(String::from(".")); | |
} | |
// iterate over the vector of args ignoring the first argument |
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
pub fn main() { | |
// collect the command line arguments into a vector of string | |
let argv: Vec<String> = std::env::args().collect(); | |
// iterate over the vector of args ignoring the first argument | |
for arg in &argv[1..] { | |
// ignore args starting with '-' | |
if !arg.starts_with("-") { | |
// print argument without newline | |
print!( |
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 ( | |
"encoding/json" | |
"log" | |
"net/http" | |
"github.com/google/uuid" | |
"github.com/gorilla/mux" | |
) |
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
//A spinning doughnut made in C. | |
//Found that on a Youtube vid, very cool though. | |
#include <stdio.h> | |
#include <math.h> | |
#include <string.h> | |
int main() | |
{ | |
int k; |
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
""" | |
This example bot is structured in multiple files and is made with the goal of showcasing commands, events and cogs. | |
Although this example is not intended as a complete bot, but as a reference aimed to give you a basic understanding for | |
creating your bot, feel free to use these examples and point out any issue. | |
+ These examples are made with educational purpose and there are plenty of docstrings and explanation about most of the code. | |
+ This example is made with Python 3.8.5 and Discord.py 1.4.0a (rewrite). | |
Documentation: |