Skip to content

Instantly share code, notes, and snippets.

View samcv's full-sized avatar

Samantha McVey samcv

  • Amsterdam, Netherlands
View GitHub Profile
@samcv
samcv / system-sleep-xhci.sh
Last active December 6, 2023 10:32 — forked from ioggstream/system-sleep-xhci.sh
Disable broken xhci device before suspend and avoid freeze.
#!/bin/bash
#
# This script should prevent the following suspend errors
# which freezes the Dell Inspiron laptop.
#
# Put it in /usr/lib/systemd/system-sleep/xhci.sh
#
# The PCI 00:14.0 device is the usb xhci controller.
#
# kernel: [67445.560610] pci_pm_suspend(): hcd_pci_suspend+0x0/0x30 returns -16
--- TLP 1.1.902+git-master-20181020 --------------------------------------------
+++ Configured Settings: /etc/tlp.conf
TLP_ENABLE=1
TLP_DEFAULT_MODE=BAT
TLP_PERSISTENT_DEFAULT=0
DISK_IDLE_SECS_ON_AC=0
DISK_IDLE_SECS_ON_BAT=2
MAX_LOST_WORK_SECS_ON_AC=15
MAX_LOST_WORK_SECS_ON_BAT=60
--- TLP 1.1.902+git-master-20181020 --------------------------------------------
+++ Configured Settings: /etc/tlp.conf
TLP_ENABLE=1
TLP_DEFAULT_MODE=BAT
TLP_PERSISTENT_DEFAULT=0
DISK_IDLE_SECS_ON_AC=0
DISK_IDLE_SECS_ON_BAT=2
MAX_LOST_WORK_SECS_ON_AC=15
MAX_LOST_WORK_SECS_ON_BAT=60
#!/usr/bin/env sh
ZENSTATES=/home/samantha/bin/zenstates.py
if [ "$1" = 'post' ]; then
if "$ZENSTATES" --c6-enable; then
echo "Enabled c6 cpu state"
else
echo "Failed to enable c6 cpu state"
fi
else
if "$ZENSTATES" --c6-disable; then
#!/usr/bin/env bash
# based on https://lists.freebsd.org/pipermail/freebsd-current/2018-June/069799.html
get_value () {
location="$1"
cpu="$2"
rdmsr --processor "$cpu" --decimal "$location" || exit "$?"
}
write_value () {
location="$1"
value="$2"
gdb connmand master
GNU gdb (Gentoo 8.1 p1) 8.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
--- a/dlls/ole32/compobj.c
+++ b/dlls/ole32/compobj.c
@@ -3213,6 +3213,7 @@
{
MULTI_QI multi_qi = { iid };
HRESULT hres;
+ CoInitialize(NULL);
TRACE("(rclsid=%s, pUnkOuter=%p, dwClsContext=%08x, riid=%s, ppv=%p)\n", debugstr_guid(rclsid),
pUnkOuter, dwClsContext, debugstr_guid(iid), ppv);
[f36d4df2] {6model} Fix Vim-o leading to wrong usage deletion | src/6model/reprs/P6opaque.c
[4fa8c855] {6model} Stub in new fields for lazy context traversal | src/6model/reprs/MVMContext.h
[940c02be] {6model} Move context creation to MVMContext.c | src/6model/reprs/MVMContext.c, src/6model/reprs/MVMContext.h, src/core/frame.c, src/core/frame.h, src/core/interp.c, src/debug/debugserver.c, src/jit/x64/emit.dasc
[df6271af] {6model} Update MVMContext at_key/exists_key to traverse | src/6model/reprs/MVMContext.c, src/core/frame.c, src/spesh/frame_walker.c, src/spesh/frame_walker.h
[b2c8d3ff] {6model} Update forceouterctx to traverse | src/6model/reprs/MVMContext.c, src/6model/reprs/MVMContext.h, src/core/interp.c, src/spesh/frame_walker.c, src/spesh/frame_walker.h
[2194358c] {6model} Die more politely in MVMContext clone | src/6model/reprs/MVMContext.c
[50262e3c] {6model} Update bind_key in MVMContext for traversal | src/6model/reprs/MVMContext.c
[3da1e5fb] {6model} Preserve enough data for accurate traversal | s
@samcv
samcv / gitlog.p6
Last active August 21, 2018 23:04
#!/usr/bin/env perl6
use v6;
=TITLE Git::Log
=SUBTITLE Gets the git log as a Perl 6 object
=DESCRIPTION
=para
The first argument is the command line args wanted to be passed into C<git log>.
Optionally you can also get the files changes as well as the number of lines
added or deleted.
=para
hash = {}
num = 1000000
for i in range(num):
hash[i] = 1
for j in (2,3,4,5,6):
for i in range(0, num, j):
del hash[i]
for i in range(0, num, j):
hash[i] = 1