Skip to content

Instantly share code, notes, and snippets.

View msjyoo's full-sized avatar

Michael Yoo msjyoo

View GitHub Profile
@ygrenzinger
ygrenzinger / MonadExs.hs
Last active December 14, 2022 07:39
Functor -> Applicative -> Monad typeclasses
-- Two datatypes
data Optional a = Some a | Empty deriving (Eq, Show)
data Or a b = A a | B b deriving (Eq, Show)
-- functor instances
instance Functor Optional where
fmap f (Some a) = Some (f a)
fmap _ Empty = Empty
instance Functor (Or a) where
@fghaas
fghaas / 75-input.rules
Last active May 10, 2018 16:55
Attempt to disable AlpsPS/2 ALPS DualPoint Stick as an input device (via udev)
# /etc/udev/rules.d/75-input.rules
# local udev rules for input devices
ACTION!="add|change", GOTO="input_end"
# ALPS DualPoint Stick: Ignore as input device
ENV{ID_BUS}=="i8042", ENV{NAME}=="AlpsPS/2 ALPS DualPoint Stick", ENV{ID_INPUT}="", ENV{ID_INPUT_MOUSE}="", ENV{ID_INPUT_POINTINGSTICK}=""
LABEL="input_end"
@msjyoo
msjyoo / list-of-things-php-static-analyser-inspector.md
Last active November 5, 2015 14:14
List of things a PHP Static Analyser / Inspector must accomplish to truly understand the code.
  • Parse all return types of functions through PHPDoc
  • Parse all return types of functions implicitly through return statements. PHPDocs take precedence.
  • Type polymorphism through if, foreach etc. statements

Object Oriented Programming

  • Inheritance constraints verification
  • Inheritance type check
@sarciszewski
sarciszewski / README.md
Created May 30, 2015 04:25
A Crusade Against Bad Code

Aniruddh Agarwal blogged A short tour of PHP, and this is one of the negatives he identified:

Community: I know. I said that PHPs community was an advantage to it, but it is also a disadvantage, because of BAD CODE. Beginners are not taught the best practices and they go on to write bad code and distribute it, either as answers on Stack Overflow or similar websites or blog about it, which encourages other beginners to adopt those practices. There is a lot of misinformation out there, and it is very difficult to separate the good from the bad. This is perhaps the worst thing about PHP, because PHP is an entry-level language and people learning it are usually not aware of the best practices.

This is spot on!

The existence of BAD CODE being copied and pasted by newcomers is probably the biggest source of exploitable security vulnerabilities in the entire industry.

The biggest offenders are often the highest ranking search results on Google and other search eng

@brentp
brentp / compare-wrappers.py
Last active May 2, 2024 08:11
compare call overhead of cffi and cython
"""
Compare speed of a cython wrapper vs a cffi wrapper to the same underlying
C-code with a fast function and a longer-running function.
This should run anywhere that has cffi and cython installed.
Ouput on my machine with python2.7:
brentp@liefless:/tmp$ python compare-wrappers.py
@jashkenas
jashkenas / semantic-pedantic.md
Last active November 29, 2023 14:49
Why Semantic Versioning Isn't

Spurred by recent events (https://news.ycombinator.com/item?id=8244700), this is a quick set of jotted-down thoughts about the state of "Semantic" Versioning, and why we should be fighting the good fight against it.

For a long time in the history of software, version numbers indicated the relative progress and change in a given piece of software. A major release (1.x.x) was major, a minor release (x.1.x) was minor, and a patch release was just a small patch. You could evaluate a given piece of software by name + version, and get a feeling for how far away version 2.0.1 was from version 2.8.0.

But Semantic Versioning (henceforth, SemVer), as specified at http://semver.org/, changes this to prioritize a mechanistic understanding of a codebase over a human one. Any "breaking" change to the software must be accompanied with a new major version number. It's alright for robots, but bad for us.

SemVer tries to compress a huge amount of information — the nature of the change, the percentage of users that wil

@sheerun
sheerun / certgen.rb
Last active April 10, 2022 15:39
Docker TLS certificate generator
# Generates necessary certificates to ~/.docker
#
# Usage:
# bundle install
# ruby certgen.rb <domain>
require 'certificate_authority'
require 'fileutils'
if ARGV.empty?
@shoghicp
shoghicp / banned.md
Last active May 20, 2018 19:27
Ban List of #mcpedevs and #pocketmine

#mcpedevs

  • LoveJoy: (aka xXDARK_KNIGHTXx, *lovejoy, lovejoy1598, DJ_HeRtBrEaK, mcpelover +more) Swearing, pirating MCPE, Spamming, Spamming Quote bot, Multiple ban evasion. by Intyre, shoghicp
  • KevinWang_China: (aka VanishedKevin) Malicious plugin creation, spamming, Ban Evasion. by shoghicp
  • Xiang: (aka NgJinXiang) Spamming questions. by Intyre
  • nikony: Spamming pacman. by Intyre
  • shader: (aka Shad-Bot, proCmd) Insulting, advertising, ban evasion related logs. by shoghicp
  • TrilogiForce: Spamming, threatening the team. by Brandon15811
  • JasperBeastHD: (aka JasperHD, JassperBeastHD) Insulting moderators, evading ban. some related logs. by Brandon15811
  • DarkDemon101: Pinging main developers needlessly, asking to be admin/tester/co-owner after being told to stop. by shoghicp
  • Striker209_MPE: Spammin
@krakjoe
krakjoe / pthreads.md
Last active August 30, 2023 18:30
pthreads.md

Multi-Threading in PHP with pthreads

A Brief Introduction to Multi-Threading in PHP

  • Foreword
  • Execution
  • Sharing
  • Synchronization
  • Pitfalls
hg clone https://bitbucket.org/ZyX_I/vim
cd vim
hg update 24-bit-xterm
cd src && make autoconf && cd ..
./configure \
--enable-gui=no \
--without-x \
--enable-multibyte \
--with-tlib=ncurses \