Skip to content

Instantly share code, notes, and snippets.

View kangalio's full-sized avatar

kangalio kangalio

View GitHub Profile
@kangalio
kangalio / letter_diamond.bf
Created November 19, 2021 09:57
Brainfuck implementation of a variable size letter diamond shape
We use cell 1 and 2 as temp cells for copying or building values
+++++++++++++++++++++++++++ 4 to cell 0
>>+++++++++[>+++++<-]>+ 46 (ASCII dot) to cell 3; cell 2 temp; =3
<++++++++[>>++++++++<<-]>>+ 97 (ASCII 'A') to cell 4; cell 2 temp; =4
>++++++++++ 10 (ASCII newline) to cell 5
<<<<<[>+>>.<<<-]>[<+>-] print cell 3 {cell 0} times; cell 1 temp
>>>. print cell 4
<<<<[>+>>.<<<-]>[<+>-] print cell 3 {cell 0} times; cell 1 temp
#![allow(clippy::or_fun_call)]
// deliberately not copy with the intention to prevent accidental copies and confusion
#[derive(Clone, Debug)]
pub struct Arguments<'a> {
pub args: &'a str,
}
impl<'a> Arguments<'a> {
/// Pop a whitespace-separated word from the front of the arguments.
#![allow(clippy::needless_range_loop)]
trait MyItertools: Iterator + Sized {
/// This function will yield the iterator's next item, but only if that item is the only item
fn into_single(mut self) -> Option<Self::Item> {
let first_item = self.next()?;
if self.next().is_some() {
None
} else {
Some(first_item)
@kangalio
kangalio / all-discord-emojis-2020-05-08.json
Last active August 13, 2021 04:46
This is an exhaustive list of all Discord emojis in use as of 2020-05-08. It's scraped from the Discord Javascript source code. Licensed under the [CC0](https://creativecommons.org/publicdomain/zero/1.0/legalcode) (effectively public domain)
{
"people": [
{
"names": [
"grinning"
],
"surrogates": "😀",
"unicodeVersion": 6.1
},
{
This file has been truncated, but you can view the full file.
[
{
"username": "Arkhys",
"years": [
2019.695890410959,
2019.6986301369864
],
"ratings": [
6.04,
6.778333333333332
https://drive.google.com/open?id=1ZEXMQSeb5c6mOQTngDeNNdOZ5e7HH1Xw
@kangalio
kangalio / main.rs
Created July 2, 2018 13:10
Script to repair ISO files (doesn't really work)
use std::fs::File;
use std::io::prelude::*;
const BUF_SIZE: usize = 65536;
fn process_bytes(bytes: Vec<Box<[u8; BUF_SIZE]>>) {
let mut out_buf = [0_u8; BUF_SIZE];
for i in 0..BUF_SIZE {
let sum: usize = bytes.iter().map(|s| s[i] as usize).sum();
let result = (sum as f32 / bytes.len() as f32).round();
@kangalio
kangalio / trance-classics.txt
Created May 31, 2018 12:35
A list of all the songs the YouTube channel "Trance Classics" had uploaded before he was banned because of copyright strikes.
24 - The Longest Day (Armin Van Buuren Remix) [2004]
2HD - Sunflakes (Vincent De Moor Remix) [1998]
2Trance & Moonforce - Sunset On Ibiza (Original Mix) [2007]
3 Voices - Nightflight (Future Mix) [1994]
4 Strings - All Around The World
4 Strings - Catch A Fall (Club Mix)
4 Strings - Daytime (Gizeh Remix) [2000]
4 Strings - Desire (DJ 4 Strings Remix)
4 Strings - Desire (Original Mix)
4 Strings - Diving (Hiver & Hammer's Different Gear Remix) [2002]
@kangalio
kangalio / Main.java
Created August 26, 2016 18:03
Small helper for Josephus Problem
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Iterator;
import java.util.ArrayList;
import java.util.Scanner;
public class Main {
public static int[] test(int anzahl,boolean[] pattern) {
Deque<Integer> karten=new ArrayDeque<Integer>();
int[] ergebnis=new int[anzahl];