This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| phrases = ''' | |
| ; 希腊字母: 参考 https://en.wikipedia.org/wiki/Greek_alphabet | |
| Alpha,1=Α | |
| alpha,1=α | |
| Nu,9=Ν | |
| nu,9=ν | |
| Beta,1=Β |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env nix-build | |
| { nixpkgs ? (import <nixpkgs> {}) }: with nixpkgs; | |
| stdenv.mkDerivation rec { | |
| pname = "some-c-project"; | |
| version = "0.1"; | |
| src = ./.; | |
| nativeBuildInputs = [ cmake ]; #replace to your build time dependencies | |
| buildInputs = [ libssl ]; #replace to your runtime dependencies | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env nix-shell | |
| #! nix-shell shell.nix | |
| { pkgs ? import <nixpkgs> {} }: | |
| (pkgs.buildFHSUserEnv { | |
| name = "devbox"; | |
| targetPkgs = pkgs: (with pkgs; [ | |
| python38 | |
| python38Packages.pip |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env nix-shell | |
| #! nix-shell -p "ghc" | |
| #! nix-shell -i "runghc" | |
| -- https://www.zhihu.com/question/23999095/answer/2254625328 | |
| import Control.Monad (guard) | |
| brain_states :: (Int, Int) -> [Int] | |
| brain_states (x, y) = [z | z <- [x + y, abs(x - y)], z > 0] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| #echo '$@ = ' "$@" | |
| nixfile="$1"; shift | |
| #echo "nixfile =" "$nixfile" | |
| outpath="$(nix-build --pure $nixfile)" | |
| #echo "outpath =" "$outpath" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env -S bash -c 'nix-shell --pure $0 -A env' | |
| # Usage: | |
| # 1. run directly to enter bash (inside venv): `./venv-py37.nix` | |
| # 2. build a standalone executable: `nix bundle -f ./venv-py37.nix` #this not works yet since it cause nested `unshare -U` call | |
| # 3. run bash with extra arguments: `nix run -f ./venv-py37.nix '' -- -c 'python --version'` | |
| # More: | |
| # 1. commit id of nixpkgs can be found here: https://lazamar.co.uk/nix-versions/?channel=nixpkgs-unstable&package=python3 | |
| let |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env nix-shell | |
| #! nix-shell -p "expect" -i expect | |
| #set timeout -1 | |
| cd ~/ws/nixos | |
| spawn nix repl | |
| send ":lf .\n" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | |
| inputs.flake-utils.url = "github:numtide/flake-utils"; | |
| outputs = { self, nixpkgs, flake-utils }: | |
| flake-utils.lib.eachDefaultSystem (system: | |
| let | |
| pkgs = nixpkgs.legacyPackages.${system}; | |
| hpkgs = pkgs.haskell.packages.ghc923; | |
| in rec { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #NOTE: not working yet, need debuging | |
| {pkgs ? import <nixpkgs> {}, ...}: | |
| pkgs.stdenv.mkDerivation rec { | |
| pname = "popo"; | |
| version = "3.56.1"; | |
| src = pkgs.fetchurl { | |
| url = "https://popo.netease.com/file/popolinux/popo_${version}_amd64_ubuntu.deb"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "files.trimTrailingWhitespace": true, | |
| "python.languageServer": "Pylance", | |
| "python.analysis.typeCheckingMode": "strict", | |
| "python.analysis.diagnosticSeverityOverrides": { | |
| "reportImportCycles": "warning", | |
| "reportUnnecessaryComparison": "information", | |
| "reportUnnecessaryIsInstance": "information", | |
| "reportUnnecessaryContains": "information", | |
| "reportUnusedImport": "information", |