Skip to content

Instantly share code, notes, and snippets.

(defun insert-hello ()
(interactive)
(insert "hello"))
;; Define a function to cancel the keymap override
(defun cancel-override ()
(interactive)
;; Remove the override from `minor-mode-overriding-map-alist`
(setq minor-mode-overriding-map-alist
(assq-delete-all 'copilot-mode minor-mode-overriding-map-alist)))
@timcharper
timcharper / copilot-electric-indent-workaround.el
Last active February 9, 2024 04:33
Some modes, like typescript-mode, cause electric-indent-mode to interfere with copilot
;; see https://github.com/copilot-emacs/copilot.el/issues/250
(defun copilot/cancel-on-electric-indent-chars (arg)
"Cancel copilot completion eagerly when electric-indent-mode is triggered."
(interactive "p")
;; clear the overlay if visible and keypress is in electric-indent-chars. Not really a rejection, so maybe let's not notify it as such?
(when (and (copilot--overlay-visible)
(memq last-command-event electric-indent-chars))
@timcharper
timcharper / repro.org
Created February 1, 2024 22:24
Reproduce dape jest integratedTerminal issue

Create the files

mkdir -p src/__tests__/

cat <<-EOF > ./package.json
{
  "name": "debug-repro",

Keybase proof

I hereby claim:

  • I am timcharper on github.
  • I am timcharper (https://keybase.io/timcharper) on keybase.
  • I have a public key ASAArrwBGzgx-G6HftrQEiwrRODyANlf7FgG4mZfkyChewo

To claim this, I am signing this object:

@timcharper
timcharper / mem.py
Created May 13, 2020 18:25
Allocate n mb per second
#!/usr/bin/env python3
from time import sleep
from sys import exit, argv, getsizeof
# this simple python script allocates memory, waits for a while, and then exits successfully
mem = 0
allocs = []
try:
mem = int(argv[1])
except ValueError:
print("Usage: mem.py <mb-to-allocate-per-cycle>")
#!/usr/bin/env python3
from time import sleep
from sys import exit, argv, getsizeof
# this simple python script allocates memory, waits for a while, and then exits successfully
mem = 0
try:
mem = int(argv[1])
except ValueError:
print("Usage: mem.py <mb-to-allocate>")
exit()
@timcharper
timcharper / apnea-plots.R
Created January 19, 2020 17:32
Apnea Plots
require("tidyverse")
require("ggplot2")
require("dplyr")
## install.packages("tidyverse")
require("lubridate")
pressure_begin6 = as.Date("2019-11-01")
pressure_begin10 = as.Date("2019-12-09")
pressure_begin6_r2 = as.Date("2019-12-23")
pressure_begin10_r2 = as.Date("2020-01-03")
Nov 19 18:44:23 ip-....internal marathon.sh[10865]: [2019-11-19 18:44:23,612] INFO Migration for storage: Version(18, 200, 0, PERSISTENCE_STORE) to target: Version(19, 300, 0, PERSISTENCE_STORE): apply change for version: Version(19, 200, 0, PERSISTENCE_STORE) (mesosphere.marathon.storage.migration.Migration:scala-execution-context-global-65)
Nov 19 18:44:23 ip-....internal marathon.sh[10865]: [2019-11-19 18:44:23,646] INFO Starting migration to 1.9.200 (mesosphere.marathon.storage.migration.MigrationTo19200:scala-execution-context-global-64)
Nov 19 18:44:23 ip-....internal marathon.sh[10865]: [2019-11-19 18:44:23,698] INFO Leadership ended with failure; exiting (mesosphere.marathon.core.election.ElectionServiceImpl:marathon-akka.actor.default-dispatcher-4)
Nov 19 18:44:23 ip-....internal marathon.sh[10865]: mesosphere.marathon.MigrationFailedException: while migrating storage to major: 19
Nov 19 18:44:23 ip-....internal marathon.sh[10865]: minor: 200
Nov 19 18:44:23 ip-....internal marathon.sh[10865]: pa
➜ ~ diskutil list
/dev/disk0 (internal, physical):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *1.0 TB disk0
1: Windows Recovery 554.7 MB disk0s1
2: EFI NO NAME 104.9 MB disk0s2
3: Microsoft Reserved 16.8 MB disk0s3
4: Microsoft Basic Data 1.0 TB disk0s4
@timcharper
timcharper / nailgun-build-failure.log
Created April 5, 2019 15:35
Nailgun build failure
➜ nailgun git:(master) mvn package
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] nailgun-all [pom]
[INFO] nailgun-server [jar]
[INFO] nailgun-examples [jar]
[INFO]
[INFO] ----------------------< com.facebook:nailgun-all >----------------------