Skip to content

Instantly share code, notes, and snippets.

View mstksg's full-sized avatar

Justin Le mstksg

View GitHub Profile
aahed
aalii
aargh
aarti
abaca
abaci
abacs
abaft
abaka
abamp
@mstksg
mstksg / gist:50ab748e13a72731f1b25098d823138e
Last active May 10, 2018 06:54 — forked from jchia/gist:9697ba86030ef5aa0cdfca48e2e0cbe6
How to get the HasNames instances less manually?
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE DeriveDataTypeable #-}
import ClassyPrelude
import Control.Lens
import Data.Typeable
import Data.Data
newtype Name = Name Text deriving (Monoid, Semigroup, IsString, Show, Typeable)
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveFoldable #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NoImplicitPrelude #-}
@mstksg
mstksg / GAME_MASTER_v0_1.protobuf
Created July 17, 2016 06:29 — forked from anonymous/GAME_MASTER_v0_1.protobuf
Pokemon Go decoded GAME_MASTER protobuf file v0.1
Result: 1
Items {
TemplateId: "BADGE_BATTLE_ATTACK_WON"
Badge {
BadgeType: BADGE_BATTLE_ATTACK_WON
BadgeRanks: 4
Targets: "\nd\350\007"
}
}
Items {
@mstksg
mstksg / htop-1.0.2-temperature.patch
Created May 30, 2016 23:05 — forked from rstemmer/htop-1.0.2-temperature.patch
Adds a new Meter to htop that displays your core temperatures. You need the lm_sensors package to use this meter. After applying this patch, you have to call ./autogen.sh before configuring and compiling.
diff -urN htop-1.0.2-orig/CRT.c htop-1.0.2/CRT.c
--- htop-1.0.2-orig/CRT.c 2013-03-23 14:10:29.500604247 +0100
+++ htop-1.0.2/CRT.c 2013-03-23 14:11:01.916663508 +0100
@@ -59,6 +59,9 @@
UPTIME,
BATTERY,
TASKS_RUNNING,
+ TEMPERATURE_COOL,
+ TEMPERATURE_MEDIUM,
+ TEMPERATURE_HOT,
{-# language DataKinds, PolyKinds, ScopedTypeVariables, UndecidableInstances,
FlexibleInstances, FlexibleContexts, GADTs, TypeFamilies, RankNTypes,
LambdaCase, TypeOperators, ConstraintKinds #-}
import GHC.TypeLits
import Data.Proxy
import Data.Singletons.Prelude
import Data.Singletons.Decide
import Data.Constraint
@mstksg
mstksg / dead-code-tests.hs
Created November 13, 2013 21:21 — forked from anonymous/dead-code-tests.hs
Three files, one with only main, one with main + non-referenced IO object, one with main + referenced IO object (technically, one with a larger main IO object). The non-referenced IO object is never compiled, as the resulting object files have the same md5sum.
-- test1.hs
-- No dead code: compiles to 1.22M executable
-- with stripped .o 1320 byes
-- .o file md5sum: 35ccd1647c772a5757fba3ae8bfa6542
main :: IO ()
main = getLine >>= print
-- test2.hs
-- With dead code: compiles to 1.22M executable