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
// | |
// FizzBuzz in RISC-V Assembly | |
// build: riscv64-elf-gcc -mcmodel=medany -nostdlib \ | |
// -march=rv32im -mabi=ilp32 -o start start.s | |
// run: Open in Ripes simulator ;) | |
// | |
.section .rodata | |
// Strings need to be aliged to two byte boundaries |
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
/** | |
* @brief A shitty password generator in C++ | |
*/ | |
// | |
// It's 2019, yet no command line parsers in C++ :'( | |
// | |
#include <boost/program_options.hpp> | |
namespace opt = boost::program_options; |
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 <math.h> | |
#include <stdint.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <sys/ioctl.h> | |
#include <sys/types.h> | |
#include <unistd.h> |
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 python2 | |
"""Display a rainbow color gradiant""" | |
from __future__ import print_function | |
from collections import namedtuple | |
__activity_ctx = 0.0 | |
Color = namedtuple("Color", ["red", "green", "blue"]) | |
def rainbow(seed=0, frequency=0.01): | |
"""Return a color""" |
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 work is released under the Creative Commons CC0 1.0 Universal License. | |
* | |
* Must compile with GCC for x86_64 target: | |
* gcc -fno-pie -fno-stack-protector -o hello hello.c && ./hello | |
* | |
* Last tested: 2023-10-27, on gcc-13.2 | |
* https://godbolt.org/z/o8o97Pjca | |
*/ |
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
#![feature(asm)] | |
fn rdtsc() -> u64 { | |
let eax: u32; | |
let edx: u32; | |
unsafe { | |
asm!("rdtsc; ": /* Assembly */ | |
"={eax}"(eax), "={edx}"(edx) : /* Output registers */ | |
: /* Input registers */ |
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
__module_name__ = "Hexchat L33T" | |
__module_version__ = "1.0" | |
__module_description__ = "Do you speak l33t? No? Well, now you can with /l33t" | |
__author__ = "ashafq" | |
import hexchat | |
import random | |
def l33t_enc(string): |
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 <stddef.h> | |
#include <xmmintrin.h> | |
void biquad_proc_x4(const float *coeff, | |
float *state, | |
float *io, | |
size_t len) | |
{ | |
// Set up pointers | |
const __m128 *vcoeff = (__m128 *) __builtin_assume_aligned(coeff, 16); |
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 <stddef.h> | |
#include <assert.h> | |
#include <immintrin.h> | |
static void v_f32_to_s1x15i(int16_t *dst, const float *src, size_t len) | |
{ | |
const __m128 minval = _mm_set1_ps(-1.0F); | |
const __m128 maxval = _mm_set1_ps(+0x7fffff8p-27F); | |
const __m128 scale = _mm_set1_ps(32768.0F); |
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
/* I always wondered how variable length arguments worked in C. | |
* So, I just ended up implementing it in x86. | |
* NOTE: THIS CODE BELOW ONLY WORKS IN x86, AND NOT TESTED IN ANY OTHER ARCHITECTURE. | |
* | |
* To compile: | |
* gcc -Wall -o prog vargs.c && ./prog | |
* >> Testing: Hello world 10 -100 | |
*/ | |
/* |