Skip to content

Instantly share code, notes, and snippets.

View tfc's full-sized avatar

Jacek Galowicz tfc

View GitHub Profile
@tfc
tfc / remove_miui_bloatware.sh
Created October 18, 2019 08:08
Remove most bloatware from a new Xiaomi telephone
#!/usr/bin/env bash
declare -a packages=(
com.amazon.appmanager
com.android.browser
com.android.calendar
com.android.chrome
com.android.deskclock
com.android.email
com.android.soundrecorder
Apr 17 09:31:38 jacekpad gnome-session[1173]: gnome-session-binary[1173]: WARNING: Could not get session id for session. Check that logind is properly installed and pam_systemd is getting used at login.
Apr 17 09:31:38 jacekpad gnome-session-binary[1173]: WARNING: Could not get session id for session. Check that logind is properly installed and pam_systemd is getting used at login.
Apr 17 09:31:38 jacekpad kernel: IPv6: ADDRCONF(NETDEV_UP): enp0s25: link is not ready
Apr 17 09:31:38 jacekpad nm-dispatcher[1004]: req:2 'connectivity-change': new request (2 scripts)
Apr 17 09:31:38 jacekpad nm-dispatcher[1004]: req:2 'connectivity-change': start running ordered scripts...
Apr 17 09:31:38 jacekpad kernel: IPv6: ADDRCONF(NETDEV_UP): wlp3s0: link is not ready
Apr 17 09:31:38 jacekpad gnome-session[1173]: gnome-session-binary[1173]: WARNING: Could not parse desktop file orca-autostart.desktop or it references a not found TryExec binary
Apr 17 09:31:38 jacekpad gnome-session-binary[1173]: WARNING: Could not parse de
@tfc
tfc / gist:3ec5f26ce4ea1db87ab0a41d78df183a
Created March 10, 2019 18:42
stack2nix error message on stackage LTS-13.11
$ stack2nix .
Ensuring git version is >= 2 ...
Ensuring cabal version is >= 2 ...
stack2nix: haskell.compiler.ghc864 failed to build via nix
CallStack (from HasCallStack):
error, called at src/Stack2nix/Util.hs:79:22 in stack2nix-0.2.1-9CeCKp69pLe5gkbivlNwUC:Stack2nix.Util
@tfc
tfc / crd.txt
Created February 6, 2019 11:42
Be [base, end) with base and end as unsigned integers,
a half open interval that contains all numbers from
base to end, not including end.
It is possible to divide this range into consecutive
chunks where:
- every chunk's size is a power of 2
- every chunk's base is evenly divisible by its size
#include <iostream>
#include <initializer_list>
#include <string>
template <typename ... Ts>
auto assignment_helper(Ts& ... ts) {
return [&] (const auto& ... xs) {
std::initializer_list<int>{(ts = xs, 0)...};
};
}
tup = pkgs.tup.overrideAttrs (old: rec {
version = "0.7.8";
src = pkgs.fetchFromGitHub {
owner = "gittup";
repo = "tup";
rev = "v${version}";
sha256 = "07dmz712zbs5kayf98kywp7blssgh0y2gc1623jbsynmqwi77mcb";
};
TUP_SERVER = "ldpreload";
buildPhase = "./build.sh";
@tfc
tfc / output.log
Created November 2, 2018 16:18
Output of "nix-build $nixpkgs/nixos/tests/login.nix"
these derivations will be built:
/nix/store/bk9gda8micmmz13i19gf82y7l2ywlz0k-vm-test-run-login.drv
building '/nix/store/bk9gda8micmmz13i19gf82y7l2ywlz0k-vm-test-run-login.drv'...
starting VDE switch for network 1
running the VM test script
machine: waiting for unit ‘multi-user.target’
machine: running command: systemctl --no-pager show "multi-user.target"
machine: waiting for the VM to finish booting
machine: starting vm
machine# Formatting '/tmp/nix-build-vm-test-run-login.drv-0/vm-state-machine/machine.qcow2', fmt=qcow2 size=536870912 cluster_size=65536 lazy_refcounts=off refcount_bits=16
@tfc
tfc / hydra_no_restrict.patch
Created October 21, 2018 07:58
hydra patch for relaxing the evaluation restriction
diff --git a/src/hydra-eval-jobs/hydra-eval-jobs.cc b/src/hydra-eval-jobs/hydra-eval-jobs.cc
--- a/src/hydra-eval-jobs/hydra-eval-jobs.cc
+++ b/src/hydra-eval-jobs/hydra-eval-jobs.cc
@@ -281,7 +281,7 @@ int main(int argc, char * * argv)
/* Prevent access to paths outside of the Nix search path and
to the environment. */
- evalSettings.restrictEval = true;
+ evalSettings.restrictEval = false;
@tfc
tfc / trafficLight.hs
Created March 1, 2018 11:30
Demonstration of a traffic light with state in haskell
#!/usr/bin/env stack
-- stack --resolver lts-10.7 --install-ghc runghc
import Control.Concurrent (threadDelay)
import Control.Monad.State
data TrafficLightColor = Red | Yellow | Green deriving Show
type TrafficLightState = (TrafficLightColor, Int)
@tfc
tfc / RocketExample.hs
Created November 19, 2017 14:59
class example
#!/usr/bin/env stack
{- stack --install-ghc runghc --package aeson --package hspec -}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE OverloadedStrings #-}
import Control.Applicative
import Data.Aeson
import Test.Hspec
-- Rocket.hs library file