Skip to content

Instantly share code, notes, and snippets.

View Piliponful's full-sized avatar
💭
I'm doing nothing on github

piliponful Piliponful

💭
I'm doing nothing on github
View GitHub Profile
@butaji
butaji / server.hs
Created May 29, 2011 20:27
Simple Haskell web server
import Control.Monad
import Data.Char
import System.IO
import Network
import Data.Time.LocalTime
data RequestType = GET | POST deriving (Show)
data Request = Request { rtype :: RequestType, path :: String, options :: [(String,String)] }
data Response = Response { version :: String, statuscode :: Int }
@jds375
jds375 / gist:8247318
Last active December 23, 2021 09:51
RSA Cryptosystem in Haskell

RSA Cryptosystem in Haskell

I first started functional programming a year ago using OCaml. I was learning a lot, but stopped once my schedule started to fill up. I decided that this winter I would take another shot at functional programming with Haskell. I made an end-goal of implementing the bare-bones RSA cryptosystem in Haskell and below is some commentary on what I came up with. Any comments/suggestions regarding my code and style with respect to Haskell would be greatly appreciated!

Random Number Generation

The first problem I had to tackle was random number generation. I decided to use Haskell's System.Random to generate the number. I knew that the generator wouldn't be cryptographically secure, but certainly sufficient for educational purposes. I used the simple randomRIO (m, n) method to generate a random number in the range m to n .

-- Uses System.Random to get a random Integer between m and n inclusive
randomInteger :: Integer -> Integer 
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active July 28, 2024 22:14
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@hiroshi-maybe
hiroshi-maybe / dijkstra.js
Created April 18, 2014 09:12
Implementation of `Dijkstra's algorithm` in JavaScript
var graph1 = {
vertex: ["1","2","3"],
edge: [,
/* vertex1, vertex2, weight */
["1", "2", 4],
["1", "3", 7],
["2", "3", 1]
]
},
graph2 = {
@PurpleBooth
PurpleBooth / README-Template.md
Last active July 28, 2024 03:34
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@tim-br
tim-br / set_functions.hs
Created August 2, 2015 17:40
set functions from sicp for haskell
intersection_set _ [] = []
intersection_set [] _ = []
intersection_set (x:xs) ys
| element_of_set x ys = x : intersection_set xs ys
| otherwise = intersection_set xs ys
element_of_set _ [] = False
element_of_set x (y:ys)
| x == y = True
| otherwise = element_of_set x ys
@MichalZalecki
MichalZalecki / await-async.js
Created November 13, 2015 05:16
Run generators and and await/async
import axios from "axios";
export default async function () {
const { data: { id } } = await axios.get("//localhost:3000/id");
const { data: { group } } = await axios.get("//localhost:3000/group");
const { data: { name } } = await axios.get(`//localhost:3000/${group}/${id}`);
console.log(name); // Michał
}
@JuanCaicedo
JuanCaicedo / spacemacs-learning.md
Last active June 18, 2018 19:02
Questions I've had while learning spacemacs

Questions

  • How do you navigate around directories?
    • Open tree view in files neotree
      • Shortcuts for neotree in evilmode in the docs
      • Using search (/) can be super useful to move around quickly
    • Use SPC p D to open the project root in Dired, and use SPC f j to jump to the Dired buffer corresponding to current buffer.
      • Dired shortcuts
        • copy C
        • rename R
  • delete D
@adham90
adham90 / spacemacs-keybindings
Last active July 25, 2024 23:55
spacemacs keybindings that i need to learn
SPC s c remove highlight
**** Files manipulations key bindings
Files manipulation commands (start with ~f~):
| Key Binding | Description |
|-------------+----------------------------------------------------------------|
| ~SPC f c~ | copy current file to a different location |
| ~SPC f C d~ | convert file from unix to dos encoding |
| ~SPC f C u~ | convert file from dos to unix encoding |

Aligning images

This is a guide for aligning images.

See the full Advanced Markdown doc for more tips and tricks

left alignment