View fire_and_forget.py
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
import asyncio | |
def _create_fire_and_forget(): | |
tasks = set() | |
def fire_and_forget(*args, **kwargs): | |
task = asyncio.create_task(*args, **kwargs) | |
tasks.add(task) | |
task.add_done_callback(tasks.discard) |
View semaphore.c
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 <threads.h> | |
typedef struct { | |
int value; | |
mtx_t mutex; | |
cnd_t cv; | |
} sem_t; | |
int sem_init(sem_t *sem, int value) { | |
int result; |
View remove_none.py
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 __future__ import annotations | |
from typing import List | |
import ast | |
import sys | |
def is_annotated_with_none_return(func: ast.FunctionDef) -> bool: | |
return (isinstance(func.returns, ast.NameConstant) and |
View circular_buffer.hpp
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 <exception> | |
#include <algorithm> | |
#include <utility> | |
#include <cstdlib> | |
template <typename T> | |
class CircularBuffer { | |
private: | |
const size_t capacity; | |
size_t size; |
View qtest.sh
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 | |
if [ -t 0 ]; then | |
echo "Please redirect input file to this script." | |
exit | |
fi | |
i=0 | |
sorted_output=$(./simulator | tr -d ',' | sort -k11,11 -g) |
View githubtablength.user.js
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
// ==UserScript== | |
// @name GitHub Tab Length | |
// @namespace https://gist.github.com/onlined | |
// @version 1.2.1 | |
// @description Userscript setting GitHub tab length to 4 | |
// @author Ekin Dursun | |
// @match https://*.github.com/* | |
// @grant none | |
// ==/UserScript== |
View tester.sh
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 | |
# Put Makefile, inputs and this script in the same directory. | |
files2=({x..z}{1,2}) | |
files3=({a..f}{1,2}) | |
make &>/dev/null | |
ok=true |
View sorts.c
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> | |
#include <string.h> | |
#include <stdbool.h> | |
#include <time.h> | |
#define SWAP(x,y) do { int tmp = (x); (x) = (y); (y) = tmp; } while(false) | |
// For heapsort | |
#define LEFT(x) (2*(x)+1) |