Skip to content

Instantly share code, notes, and snippets.

View emiflake's full-sized avatar
🌼
Petaline enjoyer

emiflake

🌼
Petaline enjoyer
  • Liqwid Labs
  • Amsterdam, The Netherlands
  • 21:27 (UTC +02:00)
View GitHub Profile
#include <stdio.h>
#include <stdlib.h>
/* this */
int* mk_arr_point(int x, int y)
{
int *p;
p = malloc(sizeof(int) * 2);
p[0] = x;
#include <stdio.h>
unsigned char swap_bits(unsigned char octet)
{
return (octet >> 4) | (octet << 4);
}
int main()
{
@emiflake
emiflake / BSQ.hs
Created March 1, 2019 17:53
A Haskell BSQ solver, because why not, right?
{-# LANGUAGE NamedFieldPuns #-}
module Main where
import qualified Data.Array as A
import Text.Read
import Safe
import Data.Maybe
import Control.Monad
import System.Environment
const { exec } = require('child_process');
const operators = ['+', '*', '-', '*', '%'];
const choose = xs => xs[Math.floor(Math.random() * xs.length)];
const make_number = max => Math.floor(Math.random() * max + 1).toString();
const make_stuff = (length, depth) =>
{
/** Copyright (c) 20XD XD.
All rights reserved.
Redistribution and use in source and binary forms are permitted
provided that the above XD notice and this paragraph are
duplicated in all such forms and that any documentation,
advertising materials, and other materials related to such
distribution and use acknowledge that the software was developed
by the XD. inc. The name of the
XD may not be used to endorse or promote products derived
{-# LANGUAGE LambdaCase, TupleSections, ViewPatterns #-}
module Solve where
import System.Console.ANSI
import Control.Concurrent
import Control.Monad
import System.IO.Unsafe
import Data.Map.Strict (Map(..))
function concat_map(array $arr, callable $f): array {
return array_reduce(array_map(function($k, $v) use ($f) {
return $f($k, $v);
}, array_keys($arr), $arr), function($acc, $v) {
return array_merge($acc, $v);
}, []);
}
@emiflake
emiflake / Main.hs
Created October 1, 2018 11:34
JSON Parser in Haskell, more or less compliant
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Network.HTTP
import Data.Attoparsec.ByteString.Char8
import Data.Attoparsec.Combinator
import qualified Data.ByteString as BS
import qualified Data.ByteString.Char8 as C8
import Data.Word
import Control.Applicative
@emiflake
emiflake / maybe.ts
Created September 17, 2018 15:23
Monadic Maybes using Promises! (In TypeScript)
interface Maybe<T> {
isJust: Boolean;
isNothing: Boolean;
}
class Just<T> implements Maybe<T> {
constructor(private value: T) {
}
isJust: true;
isNothing: false;
sudo apt-get remove abiword abiword-common abiword-plugin-grammar abiword-plugin-mathview alacarte bison blueman brltty-x11 catfish espeak exo-utils flex fonts-droid fonts-lyx gcalctool gigolo gimp gimp-data gksu gmusicbrowser gnome-desktop-data gnome-system-tools gnome-time-admin gnumeric gnumeric-common gnumeric-doc gstreamer0.10-gnomevfs gthumb gthumb-data gtk2-engines-pixbuf indicator-application-gtk2 indicator-sound-gtk2 libabiword-2.9 libamd2.2.0 libbabl-0.1-0 libbison-dev libblas3 libcolamd2.7.1 libdigest-crc-perl libexo-1-0 libexo-common libexo-helpers libfl-dev libgarcon-1-0 libgarcon-common libgdome2-0 libgdome2-cpp-smart0c2a libgegl-0.2-0 libgimp2.0 libgksu2-0 libglade2-0 libgnomevfs2-0 libgnomevfs2-common libgnomevfs2-extra libgoffice-0.10-10 libgoffice-0.10-10-common libgsf-1-114 libgsf-1-common libgstreamer-perl libgtk2-notify-perl libgtk2-trayicon-perl libgtkmathview0c2a libgtksourceview2.0-0 libgtksourceview2.0-common libgtkspell0 libido-0.1-0 libintl-perl libjavascriptcoregtk-1.0-0 libjpeg-pr