Skip to content

Instantly share code, notes, and snippets.

#include <stdio.h>
void printArray(int array[], int length) {
printf("{");
for (int i = 0; i < length; i++)
printf("%d, ", *(array + i));
printf("\b\b}\n");
}
int main() {return 0;)
#include <stdio.h>
#include <stdlib.h>
int * merge(int* array, int length) {
if (length < 2)
return array;
int midpoint = length / 2;
int* front = merge(array, midpoint);
int* back = merge(array + midpoint, length - midpoint);

So I want to return an array in C of length determined at runtime.

This is what I tried at first:

#include <stdio.h>

void printArray(int array[], int length) {
    for (int i = 0; i < length; i++)
        printf("%d", *(array + i));
"""Provide the EMOJI class."""
from ...const import API_PATH
from .base import RedditBase
class Emoji(RedditBase):
"""An individual Emoji object."""
__hash__ = RedditBase.__hash__
STR_FIELD = 'name'
@jarhill0
jarhill0 / gen_queryresult_code.py
Created February 1, 2018 07:06
Generating code (part 2)
import json
import os
with open('inline_query_results.json', 'r') as f:
types = json.load(f)
FORM = """
from .inline_query_result import InlineQueryResult
@jarhill0
jarhill0 / Telegram Bot API.html
Created February 1, 2018 06:32
parsing the Telegram API docs to get some info for preliminary code genereation.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Telegram Bot API</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="The Bot API is an HTTP-based interface created for developers keen on building bots for Telegram.
To learn how to create…">
<meta property="og:title" content="Telegram Bot API">
<meta property="og:image" content="">
$ python3 setup.py test
running test
running egg_info
creating pycaching.egg-info
writing pycaching.egg-info/PKG-INFO
writing dependency_links to pycaching.egg-info/dependency_links.txt
writing requirements to pycaching.egg-info/requires.txt
writing top-level names to pycaching.egg-info/top_level.txt
writing manifest file 'pycaching.egg-info/SOURCES.txt'
reading manifest file 'pycaching.egg-info/SOURCES.txt'
$ python3 setup.py test
running test
running egg_info
writing pycaching.egg-info/PKG-INFO
writing dependency_links to pycaching.egg-info/dependency_links.txt
writing requirements to pycaching.egg-info/requires.txt
writing top-level names to pycaching.egg-info/top_level.txt
reading manifest file 'pycaching.egg-info/SOURCES.txt'
writing manifest file 'pycaching.egg-info/SOURCES.txt'
running build_ext
import praw
import time
from datetime import datetime, timedelta
def hours_posted(submission):
"""Gets the time that passed (in hours) from when the post was made. (All time is converted to UTC)"""
time_created = submission.created_utc
current_time = datetime.utcnow()
time_posted = datetime.utcfromtimestamp(time_created)
time_difference_in_hours = (current_time - time_posted)/timedelta(hours=1)
@jarhill0
jarhill0 / z_table.py
Created November 28, 2017 05:19
my z-table in python
from math import sqrt, erf, erfc
from scipy.special import erfinv, erfcinv
class Table:
def __init__(self, precision=4):
self.precision = precision
def below(self, z_score):