Skip to content

Instantly share code, notes, and snippets.

View matematikaadit's full-sized avatar

Adit Cahya Ramadhan matematikaadit

View GitHub Profile
@premek
premek / mv.sh
Last active March 5, 2024 17:43
Rename files in linux / bash using mv command without typing the full name two times
# Put this function to your .bashrc file.
# Usage: mv oldfilename
# If you call mv without the second parameter it will prompt you to edit the filename on command line.
# Original mv is called when it's called with more than one argument.
# It's useful when you want to change just a few letters in a long name.
#
# Also see:
# - imv from renameutils
# - Ctrl-W Ctrl-Y Ctrl-Y (cut last word, paste, paste)

Follow-up to Method on Emulating Higher-Kinded Types (HKTs) in Rust

First off, thanks for all the comments and kind words on the original writeup; I've been meaning to follow up on some of the suggestions and write about the different ways to represent monads (and functors, HKTs, etc) that now exist, but a month of being busy has kind of gotten in the way (mainly with three new kittens!).

And for sure, I do not expect (nor do I want) this to become the norm for production-level Rust: rather, I hope that this can contribute to the foundations of programming with higher-level abstractions in Rust, somewhat like how early template metaprogramming in C++ and typeclass-constraint-unification metaprogramming in Haskell have contributed, perhaps indirectly, to later innovations in their respective languages and ecosystems that were much more reasoned, sound and usable.

Changes, Edits, Refinements

One of the things suggested in the com

@depp
depp / problem.cpp
Last active December 21, 2021 19:04
A Faster Solution
// Faster solution for:
// http://www.boyter.org/2017/03/golang-solution-faster-equivalent-java-solution/
// With threading.
// g++ -std=c++11 -Wall -Wextra -O3 -pthread
// On my computer (i5-6600K 3.50 GHz 4 cores), takes about ~160 ms after the CPU
// has warmed up, or ~80 ms if the CPU is cold (due to Turbo Boost).
// How it works: Start by generating a list of losing states -- states where the
// game can end in one turn. Generate a new list of states by running the game
@SpaceManiac
SpaceManiac / shortcircuit.rs
Created September 17, 2016 23:59
Initial sketch of user-defined short-circuiting && and || operators in Rust.
trait And<Rhs=Self> {
type Output;
fn short(&self) -> Option<Self::Output>;
fn and(self, rhs: Rhs) -> Self::Output;
}
trait Or<Rhs=Self> {
type Output;
fn short(&self) -> Option<Self::Output>;
fn or(self, rhs: Rhs) -> Self::Output;
@paulirish
paulirish / bling.js
Last active May 1, 2024 19:56
bling dot js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
}
NodeList.prototype.__proto__ = Array.prototype;

All binary can be downloaded http://pan.baidu.com/s/1hqH2Pko

Sublime Text 3, build 3083 (dev) for Windows x64

OFFSET ORIGINAL CRACKED
0xe21b3 85 3B

md5:c3522c719d24f85dd770c93b9bf9e56f

@matematikaadit
matematikaadit / DList.hs
Last active August 29, 2015 14:11
Various Haskell Code
module DList
( DList(..)
, fromList
, toList
, empty
, (|>)
, (|:)
) where
-- Difference List
@CyberShadow
CyberShadow / .gitignore
Last active November 19, 2022 04:49
"Game About Squares" solver and solutions
/solve
*.exe
*.ilk
*.pdb
*.s
*.obj
anonymous
anonymous / saleem.py
Created May 8, 2014 07:47
Saleem plugin buat hexchat
import hexchat
__module_name__ = "saleem"
__module_version__ = "1.0"
__module_description__ = "bilang saleem ke semua nick di channel"
def saleem_callback(word, word_eol, userdata):
greeting = "saleem"
if len(word) >= 2:
greeting = word_eol[1]
@eelsivart
eelsivart / heartbleed.py
Last active April 28, 2024 13:18 — forked from sh1n0b1/ssltest.py
Heartbleed (CVE-2014-0160) Test & Exploit Python Script
#!/usr/bin/python
# Modified by Travis Lee
# Last Updated: 4/21/14
# Version 1.16
#
# -changed output to display text only instead of hexdump and made it easier to read
# -added option to specify number of times to connect to server (to get more data)
# -added option to send STARTTLS command for use with SMTP/POP/IMAP/FTP/etc...
# -added option to specify an input file of multiple hosts, line delimited, with or without a port specified (host:port)