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
| # machine | |
| $path = [Environment]::GetEnvironmentVariable('ENV_NAME', 'Machine') | |
| [Environment]::SetEnvironmentVariable("ENV_NAME", $newpath, 'Machine') | |
| # user | |
| $path = [Environment]::GetEnvironmentVariable('ENV_NAME', 'User') | |
| [Environment]::SetEnvironmentVariable("ENV_NAME", $newpath, 'USer') |
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
| # generate a key pair | |
| gpg --gen-key | |
| # , with choices | |
| gpg --full-gen-key # or `--full-generate-key` | |
| # , need more choice, such as ecc key pair | |
| gpg --full-gen-key --expert | |
| # list keys | |
| gpg --list-keys # ,or shorter `-k` | |
| # , or secret key |
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
| ; A small self applicable scheme->llvm compiler. | |
| ;; , Tobias Nurmiranta | |
| ;; | |
| ;; -- To Use It -- | |
| ;; Reads scheme-code from standard input. | |
| ;; cat code.ss|mzscheme --script compile.ss|llvm-as -f -o=test.bc;lli test.bc | |
| ;; | |
| ;; The compiler is painfully slow since it for testing purposes | |
| ;; compiles all help functions as well (see variable bootstrap). | |
| ;; It extends standard scheme with a subset of available |
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
| (require lazy) | |
| (((λ (f) ((λ (x) (f (x x))) (λ (x) (f (x x))))) (λ (f) (λ (n) (if (> n 0) (string-append "别老惦记着你那破" (f (- n 1)) "了") "")))) 10) |
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
| ;;; church.scm | |
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| ;; | |
| ;; Composition helper functions | |
| ;; | |
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| (define compose | |
| (lambda (f g) |
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
| # set to system default proxy | |
| [System.Net.WebRequest]::DefaultWebProxy = [System.Net.WebRequest]::GetSystemWebProxy() | |
| [System.Net.WebRequest]::DefaultWebProxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials | |
| # or a custom one | |
| [System.Net.WebRequest]::DefaultWebProxy = New-Object System.Net.WebProxy("http://localhost:8080") | |
| # or use username and password auth | |
| [System.Net.WebRequest]::DefaultWebProxy = New-Object System.Net.WebProxy("http://localhost:8080",$true) | |
| [System.Net.WebRequest]::DefaultWebProxy.Credentials = New-Object System.Net.NetworkCredential($user, $passwd) |
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
| use std::{env::args, fs::{self, remove_file}, io::Write}; | |
| fn main() { | |
| let argv = args(); | |
| let f: Vec<String> = argv.collect(); | |
| let (path, size_str, turn_str) = (&f[1].clone(), f[2].clone(), f[3].clone()); | |
| let turn = if let Ok(turn) = turn_str.parse::<u64>(){ | |
| turn | |
| } else { |
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
| package main | |
| import ( | |
| "math/rand" | |
| "testing" | |
| ) | |
| const Max = 100_0000 | |
| const Offset = 100 |
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
| import re | |
| p = re.compile(r'(get|set)(_[_a-zA-Z0-9]+)') | |
| class A: | |
| _x = 0 | |
| def __getattr__(self, attr): | |
| m = p.match(attr) | |
| if m: | |
| return (lambda: getattr(self, m.group(2))) \ | |
| if m.group(1) == 'get' \ |
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
| from itertools import starmap | |
| points = [ | |
| (5, 16), | |
| (15, 11), | |
| (3, 5), | |
| (28, 9), | |
| (24, 25), | |
| (11, 7), | |
| (14, 22), |