When executing Python natively:
$ python pystone.py
Pystone(1.1) time for 50000 passes = 0.129016
This machine benchmarks at 387549 pystones/second
#!/usr/bin/env python3 | |
__author__ = "Akhil Mithran" | |
__maintainer__ = "AkhilCM" | |
__email__ = "[email protected]" | |
import os | |
import stat | |
import shutil | |
import argparse |
how() { | |
YELLOW='\033[1;33m' | |
NC='\033[0m' | |
if [[ "$1" == "" || "$1" == "-h" || "$1" == "--help" ]]; then | |
echo "Usage: $0 <binary name>" | |
echo "" | |
echo "This will search for the binary in a few different places and try and determine how it was installed." | |
return 1 | |
fi |
# PowerShell script to install scoop for multi-user and packages. | |
# If re-run when scoop is already installed, any additional packages | |
# are installed and shims are reset in order of the package list. | |
# I prefer to keep user and global packages as the same, so there's | |
# a minor inconvenience in some situations where packages will | |
# be listed twice with global commands. | |
# | |
# To avoid git ownership warnings, read this: | |
# https://stackoverflow.com/a/71904131/140872 | |
# git config --global --add safe.directory "*" (double quotes on Windows) |
# All my gist code is licensed under the terms of the MIT license. | |
# Video demo: https://www.youtube.com/watch?v=Dl2n_fcDjkE | |
### Add this to your .bashrc | |
# custom free | |
# - add common options | |
# - add color | |
# - add footer |
/* | |
MIT License | |
Copyright (c) 2023 Jiayin Cao | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is |
# All my gist code is licensed under the terms of the MIT license. | |
# Video demo: https://www.youtube.com/watch?v=KFtZbsSG_fA | |
# add this to your ~/.bashrc or something like that | |
# alias for every locate database | |
alias locate="glocate --regextype=posix-extended --database=${HOME}/tmp/locatedb-min" | |
alias locatehome="glocate --regextype=posix-extended --database=${HOME}/tmp/locatedb-home" | |
alias locateall="glocate --regextype=posix-extended --database=${HOME}/tmp/locatedb" |
;; emacs-gpt.el -- Control Emacs via ChatGPT | |
;; | |
;; Basic idea: take natural language input from user, ask ChatGPT for | |
;; corresponding elisp, run it. | |
(defun mark-between-assistant-and-user () | |
"Mark the region between \"%assistant%\" and \"%user%\", not including those strings." | |
(interactive) | |
(goto-char (point-min)) |
# reload source | |
alias brc="source ~/.config/fish/.bashrc" | |
# open explorer in current folder | |
alias e.="explorer ." | |
# git: log pretty | |
alias gl="git log --oneline --graph" | |
# git: status condensed |
;; Emacs Lisp wrapper around Python scripts for ChatGPT. | |
;; | |
;; Basic idea is to send buffer as stdin to Python script. | |
(defvar gpt-script "/Users/haldar/haskell/gpt_turbo/chat.py") | |
(defun vh/invoke-chat () | |
"Send contents of current buffer as stdin to command, then append output to current buffer." | |
(interactive) | |
(let* |