Skip to content

Instantly share code, notes, and snippets.

Avatar

Kenneth B. Jensen kjensenxz

View GitHub Profile
View true.s
; this > GNU's coreutils true
global _start
_start:
mov eax, 1
int 0x80
@kjensenxz
kjensenxz / isPrime.c
Last active Nov 5, 2016
/dpt/ told me to
View isPrime.c
#include <math.h>
int isPrime(int n) {
int mask = n >> 31;
n = (mask ^ n) - mask;
if (n < 4) return 1;
else if (!(n & 1)) return 0;
unsigned short i;
for (i = 3; i <= sqrt(n); i+=2) {
View gist:aeb5a71a65869069958e55c92cc82e56
global _start
_start:
add edx, 1
cmp byte [msg + edx], 0
jne _start
mov eax, 4 ; sys_write
mov ebx, 1 ; to stdout
mov ecx, msg
; edx already contains number of bytes
View truefalse.s
BITS 64
CPU X64
section .text
global _start
_start:
dec ecx ; counter register used for repnz
pop rdi ; throw away argc, could be not 1
pop rdi ; get argv[0]
View yes.asm
BITS 64
CPU X64
global _start
section .text
_start:
inc rdi ; stdout, will not change after syscall
mov rsi, y ; will not change after syscall
mov rdx, 8192 ; will not change after syscall
@kjensenxz
kjensenxz / yes.c
Created Jun 13, 2017
COHERENT Unix's yes, c. 2001
View yes.c
/*
* Produce a continuous stream of `y's
* or `n's.
*/
#include <stdio.h>
main(argc, argv)
char *argv[];
{
View init.s
BITS 64
CPU X64
section .text
global _start
%macro mount 3
mov rax, 0x53 ; sys_mkdir
mov rdi, %1 ; location
mov rsi, %3 ; mode
@kjensenxz
kjensenxz / moose.js
Created May 13, 2018
CLI client for adedomin/neomoose
View moose.js
#!/usr/bin/env node
const reladate = require('relative-date'),
https = require('https');
const mooseShade = {
0: '\x1b[47mâ–‘',
1: '\x1b[47mâ–’',
2: '\x1b[47mâ–“',
3: 'â–ˆ',