├── .gitignore ├── .gitmodules ├── README.md ├── awesomewm └── .config │ └── awesome │ └── rc.lua ├── bin └── .local │ └── scripts │ ├── artist-12 │ ├── flamegraph.pl │ ├── jedi-language-server │ ├── nodeenv │ ├── nrdp │ ├── proj.json │ ├── projector │ ├── pudb3 │ ├── screenkey │ ├── stackcollapse-perf.pl │ ├── tmux-cht.sh │ ├── tmux-nrdp │ ├── tmux-sessionizer │ ├── tmux-tvui │ ├── tmux-windowizer │ ├── typer │ └── xrandr-oh-shit ├── clean-env ├── i3 └── .config │ ├── i3 │ └── config │ └── i3status │ └── config ├── install ├── layout.bak ├── layout.txt ├── project.json ├── test2 └── .config │ └── personal │ └── test ├── tmux ├── .tmux-cht-command ├── .tmux-cht-languages └── .tmux.conf ├── tree-sitter └── .config │ └── tree-sitter │ └── config.json ├── ubuntu ├── uwuntu └── .config │ ├── .nvidia-settings-rc │ └── personal │ ├── alias │ ├── env │ └── paths ├── vim-2022 └── .config │ └── nvim │ ├── after │ └── plugin │ │ └── foo.lua │ ├── init.lua │ └── lua │ └── theprimeagen │ ├── init.lua │ ├── remap.lua │ ├── set.lua │ └── test.js ├── xkb └── .config │ └── xkb │ └── symbols │ └── real-prog-dvorak └── zsh ├── .zsh_profile └── .zshrc /.gitignore: -------------------------------------------------------------------------------- 1 | bin/.local/bin 2 | !bin/.local/bin/twitch-chat 3 | 4 | nvim/.config/nvim/plugin/packer_compiled.lua 5 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "netflix"] 2 | path = netflix 3 | url = git@github.com:ThePrimeagen/.dotfiles-netflix.git 4 | [submodule "personal"] 5 | path = personal 6 | url = git@github.com:ThePrimeagen/.dotfiles-personal.git 7 | [submodule "tree-sitter/.config/tree-sitter/tree-sitter-lua"] 8 | path = tree-sitter/.config/tree-sitter/tree-sitter-lua 9 | url = git@github.com:Azganoth/tree-sitter-lua.git 10 | [submodule "nvim/.config/nvim"] 11 | path = nvim/.config/nvim 12 | url = git@github.com:ThePrimeagen/init.lua.git 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # .dotfiles 2 | 3 | ### Kinesis Advantage 360 4 | * Will there be a travel case? 5 | * Will there be blank key caps? 6 | -------------------------------------------------------------------------------- /awesomewm/.config/awesome/rc.lua: -------------------------------------------------------------------------------- 1 | -- If LuaRocks is installed, make sure that packages installed through it are 2 | -- found (e.g. lgi). If LuaRocks is not installed, do nothing. 3 | pcall(require, "luarocks.loader") 4 | 5 | -- Standard awesome library 6 | local gears = require("gears") 7 | local awful = require("awful") 8 | require("awful.autofocus") 9 | -- Widget and layout library 10 | local wibox = require("wibox") 11 | -- Theme handling library 12 | local beautiful = require("beautiful") 13 | -- Notification library 14 | local naughty = require("naughty") 15 | local menubar = require("menubar") 16 | local hotkeys_popup = require("awful.hotkeys_popup") 17 | -- Enable hotkeys help widget for VIM and other apps 18 | -- when client with a matching name is opened: 19 | require("awful.hotkeys_popup.keys") 20 | 21 | -- Load Debian menu entries 22 | local debian = require("debian.menu") 23 | local has_fdo, freedesktop = pcall(require, "freedesktop") 24 | 25 | -- {{{ Error handling 26 | -- Check if awesome encountered an error during startup and fell back to 27 | -- another config (This code will only ever execute for the fallback config) 28 | if awesome.startup_errors then 29 | naughty.notify({ preset = naughty.config.presets.critical, 30 | title = "Oops, there were errors during startup!", 31 | text = awesome.startup_errors }) 32 | end 33 | 34 | -- Handle runtime errors after startup 35 | do 36 | local in_error = false 37 | awesome.connect_signal("debug::error", function (err) 38 | -- Make sure we don't go into an endless error loop 39 | if in_error then return end 40 | in_error = true 41 | 42 | naughty.notify({ preset = naughty.config.presets.critical, 43 | title = "Oops, an error happened!", 44 | text = tostring(err) }) 45 | in_error = false 46 | end) 47 | end 48 | -- }}} 49 | 50 | -- {{{ Variable definitions 51 | -- Themes define colours, icons, font and wallpapers. 52 | beautiful.init(gears.filesystem.get_themes_dir() .. "default/theme.lua") 53 | 54 | -- This is used later as the default terminal and editor to run. 55 | terminal = "x-terminal-emulator" 56 | editor = os.getenv("EDITOR") or "editor" 57 | editor_cmd = terminal .. " -e " .. editor 58 | 59 | -- Default modkey. 60 | -- Usually, Mod4 is the key with a logo between Control and Alt. 61 | -- If you do not like this or do not have such a key, 62 | -- I suggest you to remap Mod4 to another key using xmodmap or other tools. 63 | -- However, you can use another modifier like Mod1, but it may interact with others. 64 | modkey = "Mod1" 65 | 66 | -- Table of layouts to cover with awful.layout.inc, order matters. 67 | awful.layout.layouts = { 68 | awful.layout.suit.tile, 69 | awful.layout.suit.floating, 70 | awful.layout.suit.tile.left, 71 | awful.layout.suit.tile.bottom, 72 | awful.layout.suit.tile.top, 73 | awful.layout.suit.fair, 74 | awful.layout.suit.fair.horizontal, 75 | awful.layout.suit.spiral, 76 | awful.layout.suit.spiral.dwindle, 77 | awful.layout.suit.max, 78 | awful.layout.suit.max.fullscreen, 79 | awful.layout.suit.magnifier, 80 | awful.layout.suit.corner.nw, 81 | -- awful.layout.suit.corner.ne, 82 | -- awful.layout.suit.corner.sw, 83 | -- awful.layout.suit.corner.se, 84 | } 85 | -- }}} 86 | 87 | -- {{{ Menu 88 | -- Create a launcher widget and a main menu 89 | myawesomemenu = { 90 | { "hotkeys", function() hotkeys_popup.show_help(nil, awful.screen.focused()) end }, 91 | { "manual", terminal .. " -e man awesome" }, 92 | { "edit config", editor_cmd .. " " .. awesome.conffile }, 93 | { "restart", awesome.restart }, 94 | { "quit", function() awesome.quit() end }, 95 | } 96 | 97 | local menu_awesome = { "awesome", myawesomemenu, beautiful.awesome_icon } 98 | local menu_terminal = { "open terminal", terminal } 99 | 100 | if has_fdo then 101 | mymainmenu = freedesktop.menu.build({ 102 | before = { menu_awesome }, 103 | after = { menu_terminal } 104 | }) 105 | else 106 | mymainmenu = awful.menu({ 107 | items = { 108 | menu_awesome, 109 | { "Debian", debian.menu.Debian_menu.Debian }, 110 | menu_terminal, 111 | } 112 | }) 113 | end 114 | 115 | 116 | mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon, 117 | menu = mymainmenu }) 118 | 119 | -- Menubar configuration 120 | menubar.utils.terminal = terminal -- Set the terminal for applications that require it 121 | -- }}} 122 | 123 | -- Keyboard map indicator and switcher 124 | mykeyboardlayout = awful.widget.keyboardlayout() 125 | 126 | -- {{{ Wibar 127 | -- Create a textclock widget 128 | mytextclock = wibox.widget.textclock() 129 | 130 | -- Create a wibox for each screen and add it 131 | local taglist_buttons = gears.table.join( 132 | awful.button({ }, 1, function(t) t:view_only() end), 133 | awful.button({ modkey }, 1, function(t) 134 | if client.focus then 135 | client.focus:move_to_tag(t) 136 | end 137 | end), 138 | awful.button({ }, 3, awful.tag.viewtoggle), 139 | awful.button({ modkey }, 3, function(t) 140 | if client.focus then 141 | client.focus:toggle_tag(t) 142 | end 143 | end), 144 | awful.button({ }, 4, function(t) awful.tag.viewnext(t.screen) end), 145 | awful.button({ }, 5, function(t) awful.tag.viewprev(t.screen) end) 146 | ) 147 | 148 | local tasklist_buttons = gears.table.join( 149 | awful.button({ }, 1, function (c) 150 | if c == client.focus then 151 | c.minimized = true 152 | else 153 | c:emit_signal( 154 | "request::activate", 155 | "tasklist", 156 | {raise = true} 157 | ) 158 | end 159 | end), 160 | awful.button({ }, 3, function() 161 | awful.menu.client_list({ theme = { width = 250 } }) 162 | end), 163 | awful.button({ }, 4, function () 164 | awful.client.focus.byidx(1) 165 | end), 166 | awful.button({ }, 5, function () 167 | awful.client.focus.byidx(-1) 168 | end)) 169 | 170 | local function set_wallpaper(s) 171 | -- Wallpaper 172 | if beautiful.wallpaper then 173 | local wallpaper = beautiful.wallpaper 174 | -- If wallpaper is a function, call it with the screen 175 | if type(wallpaper) == "function" then 176 | wallpaper = wallpaper(s) 177 | end 178 | gears.wallpaper.maximized(wallpaper, s, true) 179 | end 180 | end 181 | 182 | -- Re-set wallpaper when a screen's geometry changes (e.g. different resolution) 183 | screen.connect_signal("property::geometry", set_wallpaper) 184 | 185 | awful.screen.connect_for_each_screen(function(s) 186 | -- Wallpaper 187 | set_wallpaper(s) 188 | 189 | -- Each screen has its own tag table. 190 | awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, s, awful.layout.layouts[1]) 191 | 192 | -- Create a promptbox for each screen 193 | s.mypromptbox = awful.widget.prompt() 194 | -- Create an imagebox widget which will contain an icon indicating which layout we're using. 195 | -- We need one layoutbox per screen. 196 | s.mylayoutbox = awful.widget.layoutbox(s) 197 | s.mylayoutbox:buttons(gears.table.join( 198 | awful.button({ }, 1, function () awful.layout.inc( 1) end), 199 | awful.button({ }, 3, function () awful.layout.inc(-1) end), 200 | awful.button({ }, 4, function () awful.layout.inc( 1) end), 201 | awful.button({ }, 5, function () awful.layout.inc(-1) end))) 202 | -- Create a taglist widget 203 | s.mytaglist = awful.widget.taglist { 204 | screen = s, 205 | filter = awful.widget.taglist.filter.all, 206 | buttons = taglist_buttons 207 | } 208 | 209 | -- Create a tasklist widget 210 | s.mytasklist = awful.widget.tasklist { 211 | screen = s, 212 | filter = awful.widget.tasklist.filter.currenttags, 213 | buttons = tasklist_buttons 214 | } 215 | 216 | -- Create the wibox 217 | s.mywibox = awful.wibar({ position = "top", screen = s }) 218 | 219 | -- Add widgets to the wibox 220 | s.mywibox:setup { 221 | layout = wibox.layout.align.horizontal, 222 | { -- Left widgets 223 | layout = wibox.layout.fixed.horizontal, 224 | mylauncher, 225 | s.mytaglist, 226 | s.mypromptbox, 227 | }, 228 | s.mytasklist, -- Middle widget 229 | { -- Right widgets 230 | layout = wibox.layout.fixed.horizontal, 231 | mykeyboardlayout, 232 | wibox.widget.systray(), 233 | mytextclock, 234 | s.mylayoutbox, 235 | }, 236 | } 237 | end) 238 | -- }}} 239 | 240 | -- {{{ Mouse bindings 241 | root.buttons(gears.table.join( 242 | awful.button({ }, 3, function () mymainmenu:toggle() end), 243 | awful.button({ }, 4, awful.tag.viewnext), 244 | awful.button({ }, 5, awful.tag.viewprev) 245 | )) 246 | -- }}} 247 | 248 | -- {{{ Key bindings 249 | globalkeys = gears.table.join( 250 | awful.key({ modkey, }, "s", hotkeys_popup.show_help, 251 | {description="show help", group="awesome"}), 252 | awful.key({ modkey, }, "Left", awful.tag.viewprev, 253 | {description = "view previous", group = "tag"}), 254 | awful.key({ modkey, }, "Right", awful.tag.viewnext, 255 | {description = "view next", group = "tag"}), 256 | awful.key({ modkey, }, "Escape", awful.tag.history.restore, 257 | {description = "go back", group = "tag"}), 258 | 259 | awful.key({ modkey, }, "j", 260 | function () 261 | awful.client.focus.byidx( 1) 262 | end, 263 | {description = "focus next by index", group = "client"} 264 | ), 265 | awful.key({ modkey, }, "k", 266 | function () 267 | awful.client.focus.byidx(-1) 268 | end, 269 | {description = "focus previous by index", group = "client"} 270 | ), 271 | awful.key({ modkey, }, "w", function () mymainmenu:show() end, 272 | {description = "show main menu", group = "awesome"}), 273 | 274 | -- Layout manipulation 275 | awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end, 276 | {description = "swap with next client by index", group = "client"}), 277 | awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end, 278 | {description = "swap with previous client by index", group = "client"}), 279 | awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end, 280 | {description = "focus the next screen", group = "screen"}), 281 | awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end, 282 | {description = "focus the previous screen", group = "screen"}), 283 | awful.key({ modkey, }, "u", awful.client.urgent.jumpto, 284 | {description = "jump to urgent client", group = "client"}), 285 | awful.key({ modkey, }, "Tab", 286 | function () 287 | awful.client.focus.history.previous() 288 | if client.focus then 289 | client.focus:raise() 290 | end 291 | end, 292 | {description = "go back", group = "client"}), 293 | 294 | -- Standard program 295 | awful.key({ modkey, }, "Return", function () awful.spawn(terminal) end, 296 | {description = "open a terminal", group = "launcher"}), 297 | awful.key({ modkey, "Control" }, "r", awesome.restart, 298 | {description = "reload awesome", group = "awesome"}), 299 | awful.key({ modkey, "Shift" }, "q", awesome.quit, 300 | {description = "quit awesome", group = "awesome"}), 301 | 302 | awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end, 303 | {description = "increase master width factor", group = "layout"}), 304 | awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end, 305 | {description = "decrease master width factor", group = "layout"}), 306 | awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1, nil, true) end, 307 | {description = "increase the number of master clients", group = "layout"}), 308 | awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1, nil, true) end, 309 | {description = "decrease the number of master clients", group = "layout"}), 310 | awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1, nil, true) end, 311 | {description = "increase the number of columns", group = "layout"}), 312 | awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1, nil, true) end, 313 | {description = "decrease the number of columns", group = "layout"}), 314 | awful.key({ modkey, }, "space", function () awful.layout.inc( 1) end, 315 | {description = "select next", group = "layout"}), 316 | awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(-1) end, 317 | {description = "select previous", group = "layout"}), 318 | 319 | awful.key({ modkey, "Control" }, "n", 320 | function () 321 | local c = awful.client.restore() 322 | -- Focus restored client 323 | if c then 324 | c:emit_signal( 325 | "request::activate", "key.unminimize", {raise = true} 326 | ) 327 | end 328 | end, 329 | {description = "restore minimized", group = "client"}), 330 | 331 | -- Prompt 332 | awful.key({ modkey }, "r", function () awful.screen.focused().mypromptbox:run() end, 333 | {description = "run prompt", group = "launcher"}), 334 | 335 | awful.key({ modkey }, "x", 336 | function () 337 | awful.prompt.run { 338 | prompt = "Run Lua code: ", 339 | textbox = awful.screen.focused().mypromptbox.widget, 340 | exe_callback = awful.util.eval, 341 | history_path = awful.util.get_cache_dir() .. "/history_eval" 342 | } 343 | end, 344 | {description = "lua execute prompt", group = "awesome"}), 345 | -- Menubar 346 | awful.key({ modkey }, "p", function() menubar.show() end, 347 | {description = "show the menubar", group = "launcher"}) 348 | ) 349 | 350 | clientkeys = gears.table.join( 351 | awful.key({ modkey, }, "f", 352 | function (c) 353 | c.fullscreen = not c.fullscreen 354 | c:raise() 355 | end, 356 | {description = "toggle fullscreen", group = "client"}), 357 | awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end, 358 | {description = "close", group = "client"}), 359 | awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle , 360 | {description = "toggle floating", group = "client"}), 361 | awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end, 362 | {description = "move to master", group = "client"}), 363 | awful.key({ modkey, }, "o", function (c) c:move_to_screen() end, 364 | {description = "move to screen", group = "client"}), 365 | awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end, 366 | {description = "toggle keep on top", group = "client"}), 367 | awful.key({ modkey, }, "n", 368 | function (c) 369 | -- The client currently has the input focus, so it cannot be 370 | -- minimized, since minimized clients can't have the focus. 371 | c.minimized = true 372 | end , 373 | {description = "minimize", group = "client"}), 374 | awful.key({ modkey, }, "m", 375 | function (c) 376 | c.maximized = not c.maximized 377 | c:raise() 378 | end , 379 | {description = "(un)maximize", group = "client"}), 380 | awful.key({ modkey, "Control" }, "m", 381 | function (c) 382 | c.maximized_vertical = not c.maximized_vertical 383 | c:raise() 384 | end , 385 | {description = "(un)maximize vertically", group = "client"}), 386 | awful.key({ modkey, "Shift" }, "m", 387 | function (c) 388 | c.maximized_horizontal = not c.maximized_horizontal 389 | c:raise() 390 | end , 391 | {description = "(un)maximize horizontally", group = "client"}) 392 | ) 393 | 394 | -- Bind all key numbers to tags. 395 | -- Be careful: we use keycodes to make it work on any keyboard layout. 396 | -- This should map on the top row of your keyboard, usually 1 to 9. 397 | for i = 1, 9 do 398 | globalkeys = gears.table.join(globalkeys, 399 | -- View tag only. 400 | awful.key({ modkey }, "#" .. i + 9, 401 | function () 402 | local screen = awful.screen.focused() 403 | local tag = screen.tags[i] 404 | if tag then 405 | tag:view_only() 406 | end 407 | end, 408 | {description = "view tag #"..i, group = "tag"}), 409 | -- Toggle tag display. 410 | awful.key({ modkey, "Control" }, "#" .. i + 9, 411 | function () 412 | local screen = awful.screen.focused() 413 | local tag = screen.tags[i] 414 | if tag then 415 | awful.tag.viewtoggle(tag) 416 | end 417 | end, 418 | {description = "toggle tag #" .. i, group = "tag"}), 419 | -- Move client to tag. 420 | awful.key({ modkey, "Shift" }, "#" .. i + 9, 421 | function () 422 | if client.focus then 423 | local tag = client.focus.screen.tags[i] 424 | if tag then 425 | client.focus:move_to_tag(tag) 426 | end 427 | end 428 | end, 429 | {description = "move focused client to tag #"..i, group = "tag"}), 430 | -- Toggle tag on focused client. 431 | awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9, 432 | function () 433 | if client.focus then 434 | local tag = client.focus.screen.tags[i] 435 | if tag then 436 | client.focus:toggle_tag(tag) 437 | end 438 | end 439 | end, 440 | {description = "toggle focused client on tag #" .. i, group = "tag"}) 441 | ) 442 | end 443 | 444 | clientbuttons = gears.table.join( 445 | awful.button({ }, 1, function (c) 446 | c:emit_signal("request::activate", "mouse_click", {raise = true}) 447 | end), 448 | awful.button({ modkey }, 1, function (c) 449 | c:emit_signal("request::activate", "mouse_click", {raise = true}) 450 | awful.mouse.client.move(c) 451 | end), 452 | awful.button({ modkey }, 3, function (c) 453 | c:emit_signal("request::activate", "mouse_click", {raise = true}) 454 | awful.mouse.client.resize(c) 455 | end) 456 | ) 457 | 458 | -- Set keys 459 | root.keys(globalkeys) 460 | -- }}} 461 | 462 | -- {{{ Rules 463 | -- Rules to apply to new clients (through the "manage" signal). 464 | awful.rules.rules = { 465 | -- All clients will match this rule. 466 | { rule = { }, 467 | properties = { border_width = beautiful.border_width, 468 | border_color = beautiful.border_normal, 469 | focus = awful.client.focus.filter, 470 | raise = true, 471 | keys = clientkeys, 472 | buttons = clientbuttons, 473 | screen = awful.screen.preferred, 474 | placement = awful.placement.no_overlap+awful.placement.no_offscreen 475 | } 476 | }, 477 | 478 | -- Floating clients. 479 | { rule_any = { 480 | instance = { 481 | "DTA", -- Firefox addon DownThemAll. 482 | "copyq", -- Includes session name in class. 483 | "pinentry", 484 | }, 485 | class = { 486 | "Arandr", 487 | "Blueman-manager", 488 | "Gpick", 489 | "Kruler", 490 | "MessageWin", -- kalarm. 491 | "Sxiv", 492 | "Tor Browser", -- Needs a fixed window size to avoid fingerprinting by screen size. 493 | "Wpa_gui", 494 | "veromix", 495 | "xtightvncviewer"}, 496 | 497 | -- Note that the name property shown in xprop might be set slightly after creation of the client 498 | -- and the name shown there might not match defined rules here. 499 | name = { 500 | "Event Tester", -- xev. 501 | }, 502 | role = { 503 | "AlarmWindow", -- Thunderbird's calendar. 504 | "ConfigManager", -- Thunderbird's about:config. 505 | "pop-up", -- e.g. Google Chrome's (detached) Developer Tools. 506 | } 507 | }, properties = { floating = true }}, 508 | 509 | -- Add titlebars to normal clients and dialogs 510 | { rule_any = {type = { "normal", "dialog" } 511 | }, properties = { titlebars_enabled = true } 512 | }, 513 | 514 | -- Set Firefox to always map on the tag named "2" on screen 1. 515 | -- { rule = { class = "Firefox" }, 516 | -- properties = { screen = 1, tag = "2" } }, 517 | } 518 | -- }}} 519 | 520 | -- {{{ Signals 521 | -- Signal function to execute when a new client appears. 522 | client.connect_signal("manage", function (c) 523 | -- Set the windows at the slave, 524 | -- i.e. put it at the end of others instead of setting it master. 525 | -- if not awesome.startup then awful.client.setslave(c) end 526 | 527 | if awesome.startup 528 | and not c.size_hints.user_position 529 | and not c.size_hints.program_position then 530 | -- Prevent clients from being unreachable after screen count changes. 531 | awful.placement.no_offscreen(c) 532 | end 533 | end) 534 | 535 | -- Add a titlebar if titlebars_enabled is set to true in the rules. 536 | client.connect_signal("request::titlebars", function(c) 537 | -- buttons for the titlebar 538 | local buttons = gears.table.join( 539 | awful.button({ }, 1, function() 540 | c:emit_signal("request::activate", "titlebar", {raise = true}) 541 | awful.mouse.client.move(c) 542 | end), 543 | awful.button({ }, 3, function() 544 | c:emit_signal("request::activate", "titlebar", {raise = true}) 545 | awful.mouse.client.resize(c) 546 | end) 547 | ) 548 | 549 | awful.titlebar(c) : setup { 550 | { -- Left 551 | awful.titlebar.widget.iconwidget(c), 552 | buttons = buttons, 553 | layout = wibox.layout.fixed.horizontal 554 | }, 555 | { -- Middle 556 | { -- Title 557 | align = "center", 558 | widget = awful.titlebar.widget.titlewidget(c) 559 | }, 560 | buttons = buttons, 561 | layout = wibox.layout.flex.horizontal 562 | }, 563 | { -- Right 564 | awful.titlebar.widget.floatingbutton (c), 565 | awful.titlebar.widget.maximizedbutton(c), 566 | awful.titlebar.widget.stickybutton (c), 567 | awful.titlebar.widget.ontopbutton (c), 568 | awful.titlebar.widget.closebutton (c), 569 | layout = wibox.layout.fixed.horizontal() 570 | }, 571 | layout = wibox.layout.align.horizontal 572 | } 573 | end) 574 | 575 | -- Enable sloppy focus, so that focus follows mouse. 576 | client.connect_signal("mouse::enter", function(c) 577 | c:emit_signal("request::activate", "mouse_enter", {raise = false}) 578 | end) 579 | 580 | client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end) 581 | client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end) 582 | -- }}} 583 | -------------------------------------------------------------------------------- /bin/.local/scripts/artist-12: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | scale=$1 || "1.5x1.5" 3 | set -x 4 | xrandr --output DP-0 --size 1920x1080 --pos 0x0 --scale $scale 5 | set +x 6 | 7 | -------------------------------------------------------------------------------- /bin/.local/scripts/flamegraph.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | # 3 | # flamegraph.pl flame stack grapher. 4 | # 5 | # This takes stack samples and renders a call graph, allowing hot functions 6 | # and codepaths to be quickly identified. Stack samples can be generated using 7 | # tools such as DTrace, perf, SystemTap, and Instruments. 8 | # 9 | # USAGE: ./flamegraph.pl [options] input.txt > graph.svg 10 | # 11 | # grep funcA input.txt | ./flamegraph.pl [options] > graph.svg 12 | # 13 | # Then open the resulting .svg in a web browser, for interactivity: mouse-over 14 | # frames for info, click to zoom, and ctrl-F to search. 15 | # 16 | # Options are listed in the usage message (--help). 17 | # 18 | # The input is stack frames and sample counts formatted as single lines. Each 19 | # frame in the stack is semicolon separated, with a space and count at the end 20 | # of the line. These can be generated for Linux perf script output using 21 | # stackcollapse-perf.pl, for DTrace using stackcollapse.pl, and for other tools 22 | # using the other stackcollapse programs. Example input: 23 | # 24 | # swapper;start_kernel;rest_init;cpu_idle;default_idle;native_safe_halt 1 25 | # 26 | # An optional extra column of counts can be provided to generate a differential 27 | # flame graph of the counts, colored red for more, and blue for less. This 28 | # can be useful when using flame graphs for non-regression testing. 29 | # See the header comment in the difffolded.pl program for instructions. 30 | # 31 | # The input functions can optionally have annotations at the end of each 32 | # function name, following a precedent by some tools (Linux perf's _[k]): 33 | # _[k] for kernel 34 | # _[i] for inlined 35 | # _[j] for jit 36 | # _[w] for waker 37 | # Some of the stackcollapse programs support adding these annotations, eg, 38 | # stackcollapse-perf.pl --kernel --jit. They are used merely for colors by 39 | # some palettes, eg, flamegraph.pl --color=java. 40 | # 41 | # The output flame graph shows relative presence of functions in stack samples. 42 | # The ordering on the x-axis has no meaning; since the data is samples, time 43 | # order of events is not known. The order used sorts function names 44 | # alphabetically. 45 | # 46 | # While intended to process stack samples, this can also process stack traces. 47 | # For example, tracing stacks for memory allocation, or resource usage. You 48 | # can use --title to set the title to reflect the content, and --countname 49 | # to change "samples" to "bytes" etc. 50 | # 51 | # There are a few different palettes, selectable using --color. By default, 52 | # the colors are selected at random (except for differentials). Functions 53 | # called "-" will be printed gray, which can be used for stack separators (eg, 54 | # between user and kernel stacks). 55 | # 56 | # HISTORY 57 | # 58 | # This was inspired by Neelakanth Nadgir's excellent function_call_graph.rb 59 | # program, which visualized function entry and return trace events. As Neel 60 | # wrote: "The output displayed is inspired by Roch's CallStackAnalyzer which 61 | # was in turn inspired by the work on vftrace by Jan Boerhout". See: 62 | # https://blogs.oracle.com/realneel/entry/visualizing_callstacks_via_dtrace_and 63 | # 64 | # Copyright 2016 Netflix, Inc. 65 | # Copyright 2011 Joyent, Inc. All rights reserved. 66 | # Copyright 2011 Brendan Gregg. All rights reserved. 67 | # 68 | # CDDL HEADER START 69 | # 70 | # The contents of this file are subject to the terms of the 71 | # Common Development and Distribution License (the "License"). 72 | # You may not use this file except in compliance with the License. 73 | # 74 | # You can obtain a copy of the license at docs/cddl1.txt or 75 | # http://opensource.org/licenses/CDDL-1.0. 76 | # See the License for the specific language governing permissions 77 | # and limitations under the License. 78 | # 79 | # When distributing Covered Code, include this CDDL HEADER in each 80 | # file and include the License file at docs/cddl1.txt. 81 | # If applicable, add the following below this CDDL HEADER, with the 82 | # fields enclosed by brackets "[]" replaced with your own identifying 83 | # information: Portions Copyright [yyyy] [name of copyright owner] 84 | # 85 | # CDDL HEADER END 86 | # 87 | # 11-Oct-2014 Adrien Mahieux Added zoom. 88 | # 21-Nov-2013 Shawn Sterling Added consistent palette file option 89 | # 17-Mar-2013 Tim Bunce Added options and more tunables. 90 | # 15-Dec-2011 Dave Pacheco Support for frames with whitespace. 91 | # 10-Sep-2011 Brendan Gregg Created this. 92 | 93 | use strict; 94 | 95 | use Getopt::Long; 96 | 97 | use open qw(:std :utf8); 98 | 99 | # tunables 100 | my $encoding; 101 | my $fonttype = "Verdana"; 102 | my $imagewidth = 1200; # max width, pixels 103 | my $frameheight = 16; # max height is dynamic 104 | my $fontsize = 12; # base text size 105 | my $fontwidth = 0.59; # avg width relative to fontsize 106 | my $minwidth = 0.1; # min function width, pixels 107 | my $nametype = "Function:"; # what are the names in the data? 108 | my $countname = "samples"; # what are the counts in the data? 109 | my $colors = "hot"; # color theme 110 | my $bgcolors = ""; # background color theme 111 | my $nameattrfile; # file holding function attributes 112 | my $timemax; # (override the) sum of the counts 113 | my $factor = 1; # factor to scale counts by 114 | my $hash = 0; # color by function name 115 | my $palette = 0; # if we use consistent palettes (default off) 116 | my %palette_map; # palette map hash 117 | my $pal_file = "palette.map"; # palette map file name 118 | my $stackreverse = 0; # reverse stack order, switching merge end 119 | my $inverted = 0; # icicle graph 120 | my $flamechart = 0; # produce a flame chart (sort by time, do not merge stacks) 121 | my $negate = 0; # switch differential hues 122 | my $titletext = ""; # centered heading 123 | my $titledefault = "Flame Graph"; # overwritten by --title 124 | my $titleinverted = "Icicle Graph"; # " " 125 | my $searchcolor = "rgb(230,0,230)"; # color for search highlighting 126 | my $notestext = ""; # embedded notes in SVG 127 | my $subtitletext = ""; # second level title (optional) 128 | my $help = 0; 129 | 130 | sub usage { 131 | die < outfile.svg\n 133 | --title TEXT # change title text 134 | --subtitle TEXT # second level title (optional) 135 | --width NUM # width of image (default 1200) 136 | --height NUM # height of each frame (default 16) 137 | --minwidth NUM # omit smaller functions (default 0.1 pixels) 138 | --fonttype FONT # font type (default "Verdana") 139 | --fontsize NUM # font size (default 12) 140 | --countname TEXT # count type label (default "samples") 141 | --nametype TEXT # name type label (default "Function:") 142 | --colors PALETTE # set color palette. choices are: hot (default), mem, 143 | # io, wakeup, chain, java, js, perl, red, green, blue, 144 | # aqua, yellow, purple, orange 145 | --bgcolors COLOR # set background colors. gradient choices are yellow 146 | # (default), blue, green, grey; flat colors use "#rrggbb" 147 | --hash # colors are keyed by function name hash 148 | --cp # use consistent palette (palette.map) 149 | --reverse # generate stack-reversed flame graph 150 | --inverted # icicle graph 151 | --flamechart # produce a flame chart (sort by time, do not merge stacks) 152 | --negate # switch differential hues (blue<->red) 153 | --notes TEXT # add notes comment in SVG (for debugging) 154 | --help # this message 155 | 156 | eg, 157 | $0 --title="Flame Graph: malloc()" trace.txt > graph.svg 158 | USAGE_END 159 | } 160 | 161 | GetOptions( 162 | 'fonttype=s' => \$fonttype, 163 | 'width=i' => \$imagewidth, 164 | 'height=i' => \$frameheight, 165 | 'encoding=s' => \$encoding, 166 | 'fontsize=f' => \$fontsize, 167 | 'fontwidth=f' => \$fontwidth, 168 | 'minwidth=f' => \$minwidth, 169 | 'title=s' => \$titletext, 170 | 'subtitle=s' => \$subtitletext, 171 | 'nametype=s' => \$nametype, 172 | 'countname=s' => \$countname, 173 | 'nameattr=s' => \$nameattrfile, 174 | 'total=s' => \$timemax, 175 | 'factor=f' => \$factor, 176 | 'colors=s' => \$colors, 177 | 'bgcolors=s' => \$bgcolors, 178 | 'hash' => \$hash, 179 | 'cp' => \$palette, 180 | 'reverse' => \$stackreverse, 181 | 'inverted' => \$inverted, 182 | 'flamechart' => \$flamechart, 183 | 'negate' => \$negate, 184 | 'notes=s' => \$notestext, 185 | 'help' => \$help, 186 | ) or usage(); 187 | $help && usage(); 188 | 189 | # internals 190 | my $ypad1 = $fontsize * 3; # pad top, include title 191 | my $ypad2 = $fontsize * 2 + 10; # pad bottom, include labels 192 | my $ypad3 = $fontsize * 2; # pad top, include subtitle (optional) 193 | my $xpad = 10; # pad lefm and right 194 | my $framepad = 1; # vertical padding for frames 195 | my $depthmax = 0; 196 | my %Events; 197 | my %nameattr; 198 | 199 | if ($flamechart && $titletext eq "") { 200 | $titletext = "Flame Chart"; 201 | } 202 | 203 | if ($titletext eq "") { 204 | unless ($inverted) { 205 | $titletext = $titledefault; 206 | } else { 207 | $titletext = $titleinverted; 208 | } 209 | } 210 | 211 | if ($nameattrfile) { 212 | # The name-attribute file format is a function name followed by a tab then 213 | # a sequence of tab separated name=value pairs. 214 | open my $attrfh, $nameattrfile or die "Can't read $nameattrfile: $!\n"; 215 | while (<$attrfh>) { 216 | chomp; 217 | my ($funcname, $attrstr) = split /\t/, $_, 2; 218 | die "Invalid format in $nameattrfile" unless defined $attrstr; 219 | $nameattr{$funcname} = { map { split /=/, $_, 2 } split /\t/, $attrstr }; 220 | } 221 | } 222 | 223 | if ($notestext =~ /[<>]/) { 224 | die "Notes string can't contain < or >" 225 | } 226 | 227 | # background colors: 228 | # - yellow gradient: default (hot, java, js, perl) 229 | # - green gradient: mem 230 | # - blue gradient: io, wakeup, chain 231 | # - gray gradient: flat colors (red, green, blue, ...) 232 | if ($bgcolors eq "") { 233 | # choose a default 234 | if ($colors eq "mem") { 235 | $bgcolors = "green"; 236 | } elsif ($colors =~ /^(io|wakeup|chain)$/) { 237 | $bgcolors = "blue"; 238 | } elsif ($colors =~ /^(red|green|blue|aqua|yellow|purple|orange)$/) { 239 | $bgcolors = "grey"; 240 | } else { 241 | $bgcolors = "yellow"; 242 | } 243 | } 244 | my ($bgcolor1, $bgcolor2); 245 | if ($bgcolors eq "yellow") { 246 | $bgcolor1 = "#eeeeee"; # background color gradient start 247 | $bgcolor2 = "#eeeeb0"; # background color gradient stop 248 | } elsif ($bgcolors eq "blue") { 249 | $bgcolor1 = "#eeeeee"; $bgcolor2 = "#e0e0ff"; 250 | } elsif ($bgcolors eq "green") { 251 | $bgcolor1 = "#eef2ee"; $bgcolor2 = "#e0ffe0"; 252 | } elsif ($bgcolors eq "grey") { 253 | $bgcolor1 = "#f8f8f8"; $bgcolor2 = "#e8e8e8"; 254 | } elsif ($bgcolors =~ /^#......$/) { 255 | $bgcolor1 = $bgcolor2 = $bgcolors; 256 | } else { 257 | die "Unrecognized bgcolor option \"$bgcolors\"" 258 | } 259 | 260 | # SVG functions 261 | { package SVG; 262 | sub new { 263 | my $class = shift; 264 | my $self = {}; 265 | bless ($self, $class); 266 | return $self; 267 | } 268 | 269 | sub header { 270 | my ($self, $w, $h) = @_; 271 | my $enc_attr = ''; 272 | if (defined $encoding) { 273 | $enc_attr = qq{ encoding="$encoding"}; 274 | } 275 | $self->{svg} .= < 277 | 278 | 279 | 280 | 281 | SVG 282 | } 283 | 284 | sub include { 285 | my ($self, $content) = @_; 286 | $self->{svg} .= $content; 287 | } 288 | 289 | sub colorAllocate { 290 | my ($self, $r, $g, $b) = @_; 291 | return "rgb($r,$g,$b)"; 292 | } 293 | 294 | sub group_start { 295 | my ($self, $attr) = @_; 296 | 297 | my @g_attr = map { 298 | exists $attr->{$_} ? sprintf(qq/$_="%s"/, $attr->{$_}) : () 299 | } qw(id class); 300 | push @g_attr, $attr->{g_extra} if $attr->{g_extra}; 301 | if ($attr->{href}) { 302 | my @a_attr; 303 | push @a_attr, sprintf qq/xlink:href="%s"/, $attr->{href} if $attr->{href}; 304 | # default target=_top else links will open within SVG 305 | push @a_attr, sprintf qq/target="%s"/, $attr->{target} || "_top"; 306 | push @a_attr, $attr->{a_extra} if $attr->{a_extra}; 307 | $self->{svg} .= sprintf qq/\n/, join(' ', (@a_attr, @g_attr)); 308 | } else { 309 | $self->{svg} .= sprintf qq/\n/, join(' ', @g_attr); 310 | } 311 | 312 | $self->{svg} .= sprintf qq/%s<\/title>/, $attr->{title} 313 | if $attr->{title}; # should be first element within g container 314 | } 315 | 316 | sub group_end { 317 | my ($self, $attr) = @_; 318 | $self->{svg} .= $attr->{href} ? qq/<\/a>\n/ : qq/<\/g>\n/; 319 | } 320 | 321 | sub filledRectangle { 322 | my ($self, $x1, $y1, $x2, $y2, $fill, $extra) = @_; 323 | $x1 = sprintf "%0.1f", $x1; 324 | $x2 = sprintf "%0.1f", $x2; 325 | my $w = sprintf "%0.1f", $x2 - $x1; 326 | my $h = sprintf "%0.1f", $y2 - $y1; 327 | $extra = defined $extra ? $extra : ""; 328 | $self->{svg} .= qq/\n/; 329 | } 330 | 331 | sub stringTTF { 332 | my ($self, $id, $x, $y, $str, $extra) = @_; 333 | $x = sprintf "%0.2f", $x; 334 | $id = defined $id ? qq/id="$id"/ : ""; 335 | $extra ||= ""; 336 | $self->{svg} .= qq/$str<\/text>\n/; 337 | } 338 | 339 | sub svg { 340 | my $self = shift; 341 | return "$self->{svg}\n"; 342 | } 343 | 1; 344 | } 345 | 346 | sub namehash { 347 | # Generate a vector hash for the name string, weighting early over 348 | # later characters. We want to pick the same colors for function 349 | # names across different flame graphs. 350 | my $name = shift; 351 | my $vector = 0; 352 | my $weight = 1; 353 | my $max = 1; 354 | my $mod = 10; 355 | # if module name present, trunc to 1st char 356 | $name =~ s/.(.*?)`//; 357 | foreach my $c (split //, $name) { 358 | my $i = (ord $c) % $mod; 359 | $vector += ($i / ($mod++ - 1)) * $weight; 360 | $max += 1 * $weight; 361 | $weight *= 0.70; 362 | last if $mod > 12; 363 | } 364 | return (1 - $vector / $max) 365 | } 366 | 367 | sub color { 368 | my ($type, $hash, $name) = @_; 369 | my ($v1, $v2, $v3); 370 | 371 | if ($hash) { 372 | $v1 = namehash($name); 373 | $v2 = $v3 = namehash(scalar reverse $name); 374 | } else { 375 | $v1 = rand(1); 376 | $v2 = rand(1); 377 | $v3 = rand(1); 378 | } 379 | 380 | # theme palettes 381 | if (defined $type and $type eq "hot") { 382 | my $r = 205 + int(50 * $v3); 383 | my $g = 0 + int(230 * $v1); 384 | my $b = 0 + int(55 * $v2); 385 | return "rgb($r,$g,$b)"; 386 | } 387 | if (defined $type and $type eq "mem") { 388 | my $r = 0; 389 | my $g = 190 + int(50 * $v2); 390 | my $b = 0 + int(210 * $v1); 391 | return "rgb($r,$g,$b)"; 392 | } 393 | if (defined $type and $type eq "io") { 394 | my $r = 80 + int(60 * $v1); 395 | my $g = $r; 396 | my $b = 190 + int(55 * $v2); 397 | return "rgb($r,$g,$b)"; 398 | } 399 | 400 | # multi palettes 401 | if (defined $type and $type eq "java") { 402 | # Handle both annotations (_[j], _[i], ...; which are 403 | # accurate), as well as input that lacks any annotations, as 404 | # best as possible. Without annotations, we get a little hacky 405 | # and match on java|org|com, etc. 406 | if ($name =~ m:_\[j\]$:) { # jit annotation 407 | $type = "green"; 408 | } elsif ($name =~ m:_\[i\]$:) { # inline annotation 409 | $type = "aqua"; 410 | } elsif ($name =~ m:^L?(java|javax|jdk|net|org|com|io|sun)/:) { # Java 411 | $type = "green"; 412 | } elsif ($name =~ /:::/) { # Java, typical perf-map-agent method separator 413 | $type = "green"; 414 | } elsif ($name =~ /::/) { # C++ 415 | $type = "yellow"; 416 | } elsif ($name =~ m:_\[k\]$:) { # kernel annotation 417 | $type = "orange"; 418 | } elsif ($name =~ /::/) { # C++ 419 | $type = "yellow"; 420 | } else { # system 421 | $type = "red"; 422 | } 423 | # fall-through to color palettes 424 | } 425 | if (defined $type and $type eq "perl") { 426 | if ($name =~ /::/) { # C++ 427 | $type = "yellow"; 428 | } elsif ($name =~ m:Perl: or $name =~ m:\.pl:) { # Perl 429 | $type = "green"; 430 | } elsif ($name =~ m:_\[k\]$:) { # kernel 431 | $type = "orange"; 432 | } else { # system 433 | $type = "red"; 434 | } 435 | # fall-through to color palettes 436 | } 437 | if (defined $type and $type eq "js") { 438 | # Handle both annotations (_[j], _[i], ...; which are 439 | # accurate), as well as input that lacks any annotations, as 440 | # best as possible. Without annotations, we get a little hacky, 441 | # and match on a "/" with a ".js", etc. 442 | if ($name =~ m:_\[j\]$:) { # jit annotation 443 | if ($name =~ m:/:) { 444 | $type = "green"; # source 445 | } else { 446 | $type = "aqua"; # builtin 447 | } 448 | } elsif ($name =~ /::/) { # C++ 449 | $type = "yellow"; 450 | } elsif ($name =~ m:/.*\.js:) { # JavaScript (match "/" in path) 451 | $type = "green"; 452 | } elsif ($name =~ m/:/) { # JavaScript (match ":" in builtin) 453 | $type = "aqua"; 454 | } elsif ($name =~ m/^ $/) { # Missing symbol 455 | $type = "green"; 456 | } elsif ($name =~ m:_\[k\]:) { # kernel 457 | $type = "orange"; 458 | } else { # system 459 | $type = "red"; 460 | } 461 | # fall-through to color palettes 462 | } 463 | if (defined $type and $type eq "wakeup") { 464 | $type = "aqua"; 465 | # fall-through to color palettes 466 | } 467 | if (defined $type and $type eq "chain") { 468 | if ($name =~ m:_\[w\]:) { # waker 469 | $type = "aqua" 470 | } else { # off-CPU 471 | $type = "blue"; 472 | } 473 | # fall-through to color palettes 474 | } 475 | 476 | # color palettes 477 | if (defined $type and $type eq "red") { 478 | my $r = 200 + int(55 * $v1); 479 | my $x = 50 + int(80 * $v1); 480 | return "rgb($r,$x,$x)"; 481 | } 482 | if (defined $type and $type eq "green") { 483 | my $g = 200 + int(55 * $v1); 484 | my $x = 50 + int(60 * $v1); 485 | return "rgb($x,$g,$x)"; 486 | } 487 | if (defined $type and $type eq "blue") { 488 | my $b = 205 + int(50 * $v1); 489 | my $x = 80 + int(60 * $v1); 490 | return "rgb($x,$x,$b)"; 491 | } 492 | if (defined $type and $type eq "yellow") { 493 | my $x = 175 + int(55 * $v1); 494 | my $b = 50 + int(20 * $v1); 495 | return "rgb($x,$x,$b)"; 496 | } 497 | if (defined $type and $type eq "purple") { 498 | my $x = 190 + int(65 * $v1); 499 | my $g = 80 + int(60 * $v1); 500 | return "rgb($x,$g,$x)"; 501 | } 502 | if (defined $type and $type eq "aqua") { 503 | my $r = 50 + int(60 * $v1); 504 | my $g = 165 + int(55 * $v1); 505 | my $b = 165 + int(55 * $v1); 506 | return "rgb($r,$g,$b)"; 507 | } 508 | if (defined $type and $type eq "orange") { 509 | my $r = 190 + int(65 * $v1); 510 | my $g = 90 + int(65 * $v1); 511 | return "rgb($r,$g,0)"; 512 | } 513 | 514 | return "rgb(0,0,0)"; 515 | } 516 | 517 | sub color_scale { 518 | my ($value, $max) = @_; 519 | my ($r, $g, $b) = (255, 255, 255); 520 | $value = -$value if $negate; 521 | if ($value > 0) { 522 | $g = $b = int(210 * ($max - $value) / $max); 523 | } elsif ($value < 0) { 524 | $r = $g = int(210 * ($max + $value) / $max); 525 | } 526 | return "rgb($r,$g,$b)"; 527 | } 528 | 529 | sub color_map { 530 | my ($colors, $func) = @_; 531 | if (exists $palette_map{$func}) { 532 | return $palette_map{$func}; 533 | } else { 534 | $palette_map{$func} = color($colors, $hash, $func); 535 | return $palette_map{$func}; 536 | } 537 | } 538 | 539 | sub write_palette { 540 | open(FILE, ">$pal_file"); 541 | foreach my $key (sort keys %palette_map) { 542 | print FILE $key."->".$palette_map{$key}."\n"; 543 | } 544 | close(FILE); 545 | } 546 | 547 | sub read_palette { 548 | if (-e $pal_file) { 549 | open(FILE, $pal_file) or die "can't open file $pal_file: $!"; 550 | while ( my $line = ) { 551 | chomp($line); 552 | (my $key, my $value) = split("->",$line); 553 | $palette_map{$key}=$value; 554 | } 555 | close(FILE) 556 | } 557 | } 558 | 559 | my %Node; # Hash of merged frame data 560 | my %Tmp; 561 | 562 | # flow() merges two stacks, storing the merged frames and value data in %Node. 563 | sub flow { 564 | my ($last, $this, $v, $d) = @_; 565 | 566 | my $len_a = @$last - 1; 567 | my $len_b = @$this - 1; 568 | 569 | my $i = 0; 570 | my $len_same; 571 | for (; $i <= $len_a; $i++) { 572 | last if $i > $len_b; 573 | last if $last->[$i] ne $this->[$i]; 574 | } 575 | $len_same = $i; 576 | 577 | for ($i = $len_a; $i >= $len_same; $i--) { 578 | my $k = "$last->[$i];$i"; 579 | # a unique ID is constructed from "func;depth;etime"; 580 | # func-depth isn't unique, it may be repeated later. 581 | $Node{"$k;$v"}->{stime} = delete $Tmp{$k}->{stime}; 582 | if (defined $Tmp{$k}->{delta}) { 583 | $Node{"$k;$v"}->{delta} = delete $Tmp{$k}->{delta}; 584 | } 585 | delete $Tmp{$k}; 586 | } 587 | 588 | for ($i = $len_same; $i <= $len_b; $i++) { 589 | my $k = "$this->[$i];$i"; 590 | $Tmp{$k}->{stime} = $v; 591 | if (defined $d) { 592 | $Tmp{$k}->{delta} += $i == $len_b ? $d : 0; 593 | } 594 | } 595 | 596 | return $this; 597 | } 598 | 599 | # parse input 600 | my @Data; 601 | my @SortedData; 602 | my $last = []; 603 | my $time = 0; 604 | my $delta = undef; 605 | my $ignored = 0; 606 | my $line; 607 | my $maxdelta = 1; 608 | 609 | # reverse if needed 610 | foreach (<>) { 611 | chomp; 612 | $line = $_; 613 | if ($stackreverse) { 614 | # there may be an extra samples column for differentials 615 | # XXX todo: redo these REs as one. It's repeated below. 616 | my($stack, $samples) = (/^(.*)\s+?(\d+(?:\.\d*)?)$/); 617 | my $samples2 = undef; 618 | if ($stack =~ /^(.*)\s+?(\d+(?:\.\d*)?)$/) { 619 | $samples2 = $samples; 620 | ($stack, $samples) = $stack =~ (/^(.*)\s+?(\d+(?:\.\d*)?)$/); 621 | unshift @Data, join(";", reverse split(";", $stack)) . " $samples $samples2"; 622 | } else { 623 | unshift @Data, join(";", reverse split(";", $stack)) . " $samples"; 624 | } 625 | } else { 626 | unshift @Data, $line; 627 | } 628 | } 629 | 630 | if ($flamechart) { 631 | # In flame chart mode, just reverse the data so time moves from left to right. 632 | @SortedData = reverse @Data; 633 | } else { 634 | @SortedData = sort @Data; 635 | } 636 | 637 | # process and merge frames 638 | foreach (@SortedData) { 639 | chomp; 640 | # process: folded_stack count 641 | # eg: func_a;func_b;func_c 31 642 | my ($stack, $samples) = (/^(.*)\s+?(\d+(?:\.\d*)?)$/); 643 | unless (defined $samples and defined $stack) { 644 | ++$ignored; 645 | next; 646 | } 647 | 648 | # there may be an extra samples column for differentials: 649 | my $samples2 = undef; 650 | if ($stack =~ /^(.*)\s+?(\d+(?:\.\d*)?)$/) { 651 | $samples2 = $samples; 652 | ($stack, $samples) = $stack =~ (/^(.*)\s+?(\d+(?:\.\d*)?)$/); 653 | } 654 | $delta = undef; 655 | if (defined $samples2) { 656 | $delta = $samples2 - $samples; 657 | $maxdelta = abs($delta) if abs($delta) > $maxdelta; 658 | } 659 | 660 | # for chain graphs, annotate waker frames with "_[w]", for later 661 | # coloring. This is a hack, but has a precedent ("_[k]" from perf). 662 | if ($colors eq "chain") { 663 | my @parts = split ";--;", $stack; 664 | my @newparts = (); 665 | $stack = shift @parts; 666 | $stack .= ";--;"; 667 | foreach my $part (@parts) { 668 | $part =~ s/;/_[w];/g; 669 | $part .= "_[w]"; 670 | push @newparts, $part; 671 | } 672 | $stack .= join ";--;", @parts; 673 | } 674 | 675 | # merge frames and populate %Node: 676 | $last = flow($last, [ '', split ";", $stack ], $time, $delta); 677 | 678 | if (defined $samples2) { 679 | $time += $samples2; 680 | } else { 681 | $time += $samples; 682 | } 683 | } 684 | flow($last, [], $time, $delta); 685 | 686 | warn "Ignored $ignored lines with invalid format\n" if $ignored; 687 | unless ($time) { 688 | warn "ERROR: No stack counts found\n"; 689 | my $im = SVG->new(); 690 | # emit an error message SVG, for tools automating flamegraph use 691 | my $imageheight = $fontsize * 5; 692 | $im->header($imagewidth, $imageheight); 693 | $im->stringTTF(undef, int($imagewidth / 2), $fontsize * 2, 694 | "ERROR: No valid input provided to flamegraph.pl."); 695 | print $im->svg; 696 | exit 2; 697 | } 698 | if ($timemax and $timemax < $time) { 699 | warn "Specified --total $timemax is less than actual total $time, so ignored\n" 700 | if $timemax/$time > 0.02; # only warn is significant (e.g., not rounding etc) 701 | undef $timemax; 702 | } 703 | $timemax ||= $time; 704 | 705 | my $widthpertime = ($imagewidth - 2 * $xpad) / $timemax; 706 | my $minwidth_time = $minwidth / $widthpertime; 707 | 708 | # prune blocks that are too narrow and determine max depth 709 | while (my ($id, $node) = each %Node) { 710 | my ($func, $depth, $etime) = split ";", $id; 711 | my $stime = $node->{stime}; 712 | die "missing start for $id" if not defined $stime; 713 | 714 | if (($etime-$stime) < $minwidth_time) { 715 | delete $Node{$id}; 716 | next; 717 | } 718 | $depthmax = $depth if $depth > $depthmax; 719 | } 720 | 721 | # draw canvas, and embed interactive JavaScript program 722 | my $imageheight = (($depthmax + 1) * $frameheight) + $ypad1 + $ypad2; 723 | $imageheight += $ypad3 if $subtitletext ne ""; 724 | my $titlesize = $fontsize + 5; 725 | my $im = SVG->new(); 726 | my ($black, $vdgrey, $dgrey) = ( 727 | $im->colorAllocate(0, 0, 0), 728 | $im->colorAllocate(160, 160, 160), 729 | $im->colorAllocate(200, 200, 200), 730 | ); 731 | $im->header($imagewidth, $imageheight); 732 | my $inc = < 734 | 735 | 736 | 737 | 738 | 739 | 750 | 1142 | INC 1143 | $im->include($inc); 1144 | $im->filledRectangle(0, 0, $imagewidth, $imageheight, 'url(#background)'); 1145 | $im->stringTTF("title", int($imagewidth / 2), $fontsize * 2, $titletext); 1146 | $im->stringTTF("subtitle", int($imagewidth / 2), $fontsize * 4, $subtitletext) if $subtitletext ne ""; 1147 | $im->stringTTF("details", $xpad, $imageheight - ($ypad2 / 2), " "); 1148 | $im->stringTTF("unzoom", $xpad, $fontsize * 2, "Reset Zoom", 'class="hide"'); 1149 | $im->stringTTF("search", $imagewidth - $xpad - 100, $fontsize * 2, "Search"); 1150 | $im->stringTTF("ignorecase", $imagewidth - $xpad - 16, $fontsize * 2, "ic"); 1151 | $im->stringTTF("matched", $imagewidth - $xpad - 100, $imageheight - ($ypad2 / 2), " "); 1152 | 1153 | if ($palette) { 1154 | read_palette(); 1155 | } 1156 | 1157 | # draw frames 1158 | $im->group_start({id => "frames"}); 1159 | while (my ($id, $node) = each %Node) { 1160 | my ($func, $depth, $etime) = split ";", $id; 1161 | my $stime = $node->{stime}; 1162 | my $delta = $node->{delta}; 1163 | 1164 | $etime = $timemax if $func eq "" and $depth == 0; 1165 | 1166 | my $x1 = $xpad + $stime * $widthpertime; 1167 | my $x2 = $xpad + $etime * $widthpertime; 1168 | my ($y1, $y2); 1169 | unless ($inverted) { 1170 | $y1 = $imageheight - $ypad2 - ($depth + 1) * $frameheight + $framepad; 1171 | $y2 = $imageheight - $ypad2 - $depth * $frameheight; 1172 | } else { 1173 | $y1 = $ypad1 + $depth * $frameheight; 1174 | $y2 = $ypad1 + ($depth + 1) * $frameheight - $framepad; 1175 | } 1176 | 1177 | my $samples = sprintf "%.0f", ($etime - $stime) * $factor; 1178 | (my $samples_txt = $samples) # add commas per perlfaq5 1179 | =~ s/(^[-+]?\d+?(?=(?>(?:\d{3})+)(?!\d))|\G\d{3}(?=\d))/$1,/g; 1180 | 1181 | my $info; 1182 | if ($func eq "" and $depth == 0) { 1183 | $info = "all ($samples_txt $countname, 100%)"; 1184 | } else { 1185 | my $pct = sprintf "%.2f", ((100 * $samples) / ($timemax * $factor)); 1186 | my $escaped_func = $func; 1187 | # clean up SVG breaking characters: 1188 | $escaped_func =~ s/&/&/g; 1189 | $escaped_func =~ s//>/g; 1191 | $escaped_func =~ s/"/"/g; 1192 | $escaped_func =~ s/_\[[kwij]\]$//; # strip any annotation 1193 | unless (defined $delta) { 1194 | $info = "$escaped_func ($samples_txt $countname, $pct%)"; 1195 | } else { 1196 | my $d = $negate ? -$delta : $delta; 1197 | my $deltapct = sprintf "%.2f", ((100 * $d) / ($timemax * $factor)); 1198 | $deltapct = $d > 0 ? "+$deltapct" : $deltapct; 1199 | $info = "$escaped_func ($samples_txt $countname, $pct%; $deltapct%)"; 1200 | } 1201 | } 1202 | 1203 | my $nameattr = { %{ $nameattr{$func}||{} } }; # shallow clone 1204 | $nameattr->{title} ||= $info; 1205 | $im->group_start($nameattr); 1206 | 1207 | my $color; 1208 | if ($func eq "--") { 1209 | $color = $vdgrey; 1210 | } elsif ($func eq "-") { 1211 | $color = $dgrey; 1212 | } elsif (defined $delta) { 1213 | $color = color_scale($delta, $maxdelta); 1214 | } elsif ($palette) { 1215 | $color = color_map($colors, $func); 1216 | } else { 1217 | $color = color($colors, $hash, $func); 1218 | } 1219 | $im->filledRectangle($x1, $y1, $x2, $y2, $color, 'rx="2" ry="2"'); 1220 | 1221 | my $chars = int( ($x2 - $x1) / ($fontsize * $fontwidth)); 1222 | my $text = ""; 1223 | if ($chars >= 3) { # room for one char plus two dots 1224 | $func =~ s/_\[[kwij]\]$//; # strip any annotation 1225 | $text = substr $func, 0, $chars; 1226 | substr($text, -2, 2) = ".." if $chars < length $func; 1227 | $text =~ s/&/&/g; 1228 | $text =~ s//>/g; 1230 | } 1231 | $im->stringTTF(undef, $x1 + 3, 3 + ($y1 + $y2) / 2, $text); 1232 | 1233 | $im->group_end($nameattr); 1234 | } 1235 | $im->group_end(); 1236 | 1237 | print $im->svg; 1238 | 1239 | if ($palette) { 1240 | write_palette(); 1241 | } 1242 | 1243 | # vim: ts=8 sts=8 sw=8 noexpandtab 1244 | -------------------------------------------------------------------------------- /bin/.local/scripts/jedi-language-server: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | # -*- coding: utf-8 -*- 3 | import re 4 | import sys 5 | from jedi_language_server.cli import cli 6 | if __name__ == '__main__': 7 | sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) 8 | sys.exit(cli()) 9 | -------------------------------------------------------------------------------- /bin/.local/scripts/nodeenv: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | # -*- coding: utf-8 -*- 3 | import re 4 | import sys 5 | from nodeenv import main 6 | if __name__ == '__main__': 7 | sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) 8 | sys.exit(main()) 9 | -------------------------------------------------------------------------------- /bin/.local/scripts/nrdp: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -x 4 | build_name=$(basename $(pwd)) 5 | nrdp_path=$HOME/work/nrdp/$build_name 6 | build_path=$HOME/work/builds/$build_name 7 | thread_count=$(projector thread_count || echo 50) 8 | 9 | if [[ $1 == "configure" ]]; then 10 | $nrdp_path/configure $(projector configure) 11 | cp $build_path/compile_commands.json $nrdp_path 12 | elif [[ $1 == "pvm-add" ]]; then 13 | pvm build add $nrdp_path -name $2 -- $(projector configure) 14 | elif [[ $1 == "build" ]]; then 15 | ninja -C $build_path -j $thread_count 16 | fi 17 | -------------------------------------------------------------------------------- /bin/.local/scripts/proj.json: -------------------------------------------------------------------------------- 1 | {"aliases":{},"projects":{"/home/mpaulson/work/projector":{"foo":"bar222"}}} -------------------------------------------------------------------------------- /bin/.local/scripts/projector: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThePrimeagen/.dotfiles/602019e902634188ab06ea31251c01c1a43d1621/bin/.local/scripts/projector -------------------------------------------------------------------------------- /bin/.local/scripts/pudb3: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | # -*- coding: utf-8 -*- 3 | import re 4 | import sys 5 | from pudb.run import main 6 | if __name__ == '__main__': 7 | sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) 8 | sys.exit(main()) 9 | -------------------------------------------------------------------------------- /bin/.local/scripts/screenkey: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | while [ : ]; do 4 | /usr/bin/screenkey --geometry 711x900+1812+0 -s medium --opacity 0.4 5 | pid=$! 6 | sleep 10 7 | kill $pid 8 | done 9 | 10 | 11 | -------------------------------------------------------------------------------- /bin/.local/scripts/stackcollapse-perf.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | # 3 | # stackcollapse-perf.pl collapse perf samples into single lines. 4 | # 5 | # Parses a list of multiline stacks generated by "perf script", and 6 | # outputs a semicolon separated stack followed by a space and a count. 7 | # If memory addresses (+0xd) are present, they are stripped, and resulting 8 | # identical stacks are colased with their counts summed. 9 | # 10 | # USAGE: ./stackcollapse-perf.pl [options] infile > outfile 11 | # 12 | # Run "./stackcollapse-perf.pl -h" to list options. 13 | # 14 | # Example input: 15 | # 16 | # swapper 0 [000] 158665.570607: cpu-clock: 17 | # ffffffff8103ce3b native_safe_halt ([kernel.kallsyms]) 18 | # ffffffff8101c6a3 default_idle ([kernel.kallsyms]) 19 | # ffffffff81013236 cpu_idle ([kernel.kallsyms]) 20 | # ffffffff815bf03e rest_init ([kernel.kallsyms]) 21 | # ffffffff81aebbfe start_kernel ([kernel.kallsyms].init.text) 22 | # [...] 23 | # 24 | # Example output: 25 | # 26 | # swapper;start_kernel;rest_init;cpu_idle;default_idle;native_safe_halt 1 27 | # 28 | # Input may be created and processed using: 29 | # 30 | # perf record -a -g -F 997 sleep 60 31 | # perf script | ./stackcollapse-perf.pl > out.stacks-folded 32 | # 33 | # The output of "perf script" should include stack traces. If these are missing 34 | # for you, try manually selecting the perf script output; eg: 35 | # 36 | # perf script -f comm,pid,tid,cpu,time,event,ip,sym,dso,trace | ... 37 | # 38 | # This is also required for the --pid or --tid options, so that the output has 39 | # both the PID and TID. 40 | # 41 | # Copyright 2012 Joyent, Inc. All rights reserved. 42 | # Copyright 2012 Brendan Gregg. All rights reserved. 43 | # 44 | # CDDL HEADER START 45 | # 46 | # The contents of this file are subject to the terms of the 47 | # Common Development and Distribution License (the "License"). 48 | # You may not use this file except in compliance with the License. 49 | # 50 | # You can obtain a copy of the license at docs/cddl1.txt or 51 | # http://opensource.org/licenses/CDDL-1.0. 52 | # See the License for the specific language governing permissions 53 | # and limitations under the License. 54 | # 55 | # When distributing Covered Code, include this CDDL HEADER in each 56 | # file and include the License file at docs/cddl1.txt. 57 | # If applicable, add the following below this CDDL HEADER, with the 58 | # fields enclosed by brackets "[]" replaced with your own identifying 59 | # information: Portions Copyright [yyyy] [name of copyright owner] 60 | # 61 | # CDDL HEADER END 62 | # 63 | # 02-Mar-2012 Brendan Gregg Created this. 64 | # 02-Jul-2014 " " Added process name to stacks. 65 | 66 | use strict; 67 | use Getopt::Long; 68 | 69 | my %collapsed; 70 | 71 | sub remember_stack { 72 | my ($stack, $count) = @_; 73 | $collapsed{$stack} += $count; 74 | } 75 | my $annotate_kernel = 0; # put an annotation on kernel function 76 | my $annotate_jit = 0; # put an annotation on jit symbols 77 | my $annotate_all = 0; # enale all annotations 78 | my $include_pname = 1; # include process names in stacks 79 | my $include_pid = 0; # include process ID with process name 80 | my $include_tid = 0; # include process & thread ID with process name 81 | my $include_addrs = 0; # include raw address where a symbol can't be found 82 | my $tidy_java = 1; # condense Java signatures 83 | my $tidy_generic = 1; # clean up function names a little 84 | my $target_pname; # target process name from perf invocation 85 | my $event_filter = ""; # event type filter, defaults to first encountered event 86 | my $event_defaulted = 0; # whether we defaulted to an event (none provided) 87 | my $event_warning = 0; # if we printed a warning for the event 88 | 89 | my $show_inline = 0; 90 | my $show_context = 0; 91 | 92 | my $srcline_in_input = 0; # if there are extra lines with source location (perf script -F+srcline) 93 | GetOptions('inline' => \$show_inline, 94 | 'context' => \$show_context, 95 | 'srcline' => \$srcline_in_input, 96 | 'pid' => \$include_pid, 97 | 'kernel' => \$annotate_kernel, 98 | 'jit' => \$annotate_jit, 99 | 'all' => \$annotate_all, 100 | 'tid' => \$include_tid, 101 | 'addrs' => \$include_addrs, 102 | 'event-filter=s' => \$event_filter) 103 | or die < outfile\n 105 | --pid # include PID with process names [1] 106 | --tid # include TID and PID with process names [1] 107 | --inline # un-inline using addr2line 108 | --all # all annotations (--kernel --jit) 109 | --kernel # annotate kernel functions with a _[k] 110 | --jit # annotate jit functions with a _[j] 111 | --context # adds source context to --inline 112 | --srcline # parses output of 'perf script -F+srcline' and adds source context 113 | --addrs # include raw addresses where symbols can't be found 114 | --event-filter=EVENT # event name filter\n 115 | [1] perf script must emit both PID and TIDs for these to work; eg, Linux < 4.1: 116 | perf script -f comm,pid,tid,cpu,time,event,ip,sym,dso,trace 117 | for Linux >= 4.1: 118 | perf script -F comm,pid,tid,cpu,time,event,ip,sym,dso,trace 119 | If you save this output add --header on Linux >= 3.14 to include perf info. 120 | USAGE_END 121 | 122 | if ($annotate_all) { 123 | $annotate_kernel = $annotate_jit = 1; 124 | } 125 | 126 | my %inlineCache; 127 | 128 | my %nmCache; 129 | 130 | sub inlineCacheAdd { 131 | my ($pc, $mod, $result) = @_; 132 | if (defined($inlineCache{$pc})) { 133 | $inlineCache{$pc}{$mod} = $result; 134 | } else { 135 | $inlineCache{$pc} = {$mod => $result}; 136 | } 137 | } 138 | 139 | # for the --inline option 140 | sub inline { 141 | my ($pc, $rawfunc, $mod) = @_; 142 | 143 | return $inlineCache{$pc}{$mod} if defined($inlineCache{$pc}{$mod}); 144 | 145 | # capture addr2line output 146 | my $a2l_output = `addr2line -a $pc -e $mod -i -f -s -C`; 147 | 148 | # remove first line 149 | $a2l_output =~ s/^(.*\n){1}//; 150 | 151 | if ($a2l_output =~ /\?\?\n\?\?:0/) { 152 | # if addr2line fails and rawfunc is func+offset, then fall back to it 153 | if ($rawfunc =~ /^(.+)\+0x([0-9a-f]+)$/) { 154 | my $func = $1; 155 | my $addr = hex $2; 156 | 157 | $nmCache{$mod}=`nm $mod` unless defined $nmCache{$mod}; 158 | 159 | if ($nmCache{$mod} =~ /^([0-9a-f]+) . \Q$func\E$/m) { 160 | my $base = hex $1; 161 | my $newPc = sprintf "0x%x", $base+$addr; 162 | my $result = inline($newPc, '', $mod); 163 | inlineCacheAdd($pc, $mod, $result); 164 | return $result; 165 | } 166 | } 167 | } 168 | 169 | my @fullfunc; 170 | my $one_item = ""; 171 | for (split /^/, $a2l_output) { 172 | chomp $_; 173 | 174 | # remove discriminator info if exists 175 | $_ =~ s/ \(discriminator \S+\)//; 176 | 177 | if ($one_item eq "") { 178 | $one_item = $_; 179 | } else { 180 | if ($show_context == 1) { 181 | unshift @fullfunc, $one_item . ":$_"; 182 | } else { 183 | unshift @fullfunc, $one_item; 184 | } 185 | $one_item = ""; 186 | } 187 | } 188 | 189 | my $result = join ";" , @fullfunc; 190 | 191 | inlineCacheAdd($pc, $mod, $result); 192 | 193 | return $result; 194 | } 195 | 196 | my @stack; 197 | my $pname; 198 | my $m_pid; 199 | my $m_tid; 200 | 201 | # 202 | # Main loop 203 | # 204 | while (defined($_ = <>)) { 205 | 206 | # find the name of the process launched by perf, by stepping backwards 207 | # over the args to find the first non-option (no dash): 208 | if (/^# cmdline/) { 209 | my @args = split ' ', $_; 210 | foreach my $arg (reverse @args) { 211 | if ($arg !~ /^-/) { 212 | $target_pname = $arg; 213 | $target_pname =~ s:.*/::; # strip pathname 214 | last; 215 | } 216 | } 217 | } 218 | 219 | # skip remaining comments 220 | next if m/^#/; 221 | chomp; 222 | 223 | # end of stack. save cached data. 224 | if (m/^$/) { 225 | # ignore filtered samples 226 | next if not $pname; 227 | 228 | if ($include_pname) { 229 | if (defined $pname) { 230 | unshift @stack, $pname; 231 | } else { 232 | unshift @stack, ""; 233 | } 234 | } 235 | remember_stack(join(";", @stack), 1) if @stack; 236 | undef @stack; 237 | undef $pname; 238 | next; 239 | } 240 | 241 | # 242 | # event record start 243 | # 244 | if (/^(\S.+?)\s+(\d+)\/*(\d+)*\s+/) { 245 | # default "perf script" output has TID but not PID 246 | # eg, "java 25607 4794564.109216: cycles:" 247 | # eg, "java 12688 [002] 6544038.708352: cpu-clock:" 248 | # eg, "V8 WorkerThread 25607 4794564.109216: cycles:" 249 | # eg, "java 24636/25607 [000] 4794564.109216: cycles:" 250 | # eg, "java 12688/12764 6544038.708352: cpu-clock:" 251 | # eg, "V8 WorkerThread 24636/25607 [000] 94564.109216: cycles:" 252 | # other combinations possible 253 | my ($comm, $pid, $tid) = ($1, $2, $3); 254 | if (not $tid) { 255 | $tid = $pid; 256 | $pid = "?"; 257 | } 258 | 259 | if (/(\S+):\s*$/) { 260 | my $event = $1; 261 | 262 | if ($event_filter eq "") { 263 | # By default only show events of the first encountered 264 | # event type. Merging together different types, such as 265 | # instructions and cycles, produces misleading results. 266 | $event_filter = $event; 267 | $event_defaulted = 1; 268 | } elsif ($event ne $event_filter) { 269 | if ($event_defaulted and $event_warning == 0) { 270 | # only print this warning if necessary: 271 | # when we defaulted and there was 272 | # multiple event types. 273 | print STDERR "Filtering for events of type: $event\n"; 274 | $event_warning = 1; 275 | } 276 | next; 277 | } 278 | } 279 | 280 | ($m_pid, $m_tid) = ($pid, $tid); 281 | 282 | if ($include_tid) { 283 | $pname = "$comm-$m_pid/$m_tid"; 284 | } elsif ($include_pid) { 285 | $pname = "$comm-$m_pid"; 286 | } else { 287 | $pname = "$comm"; 288 | } 289 | $pname =~ tr/ /_/; 290 | 291 | # 292 | # stack line 293 | # 294 | } elsif (/^\s*(\w+)\s*(.+) \((\S*)\)/) { 295 | # ignore filtered samples 296 | next if not $pname; 297 | 298 | my ($pc, $rawfunc, $mod) = ($1, $2, $3); 299 | 300 | if ($show_inline == 1 && $mod !~ m/(perf-\d+.map|kernel\.|\[[^\]]+\])/) { 301 | my $inlineRes = inline($pc, $rawfunc, $mod); 302 | # - empty result this happens e.g., when $mod does not exist or is a path to a compressed kernel module 303 | # if this happens, the user will see error message from addr2line written to stderr 304 | # - if addr2line results in "??" , then it's much more sane to fall back than produce a '??' in graph 305 | if($inlineRes ne "" and $inlineRes ne "??" and $inlineRes ne "??:??:0" ) { 306 | unshift @stack, $inlineRes; 307 | next; 308 | } 309 | } 310 | 311 | # Linux 4.8 included symbol offsets in perf script output by default, eg: 312 | # 7fffb84c9afc cpu_startup_entry+0x800047c022ec ([kernel.kallsyms]) 313 | # strip these off: 314 | $rawfunc =~ s/\+0x[\da-f]+$//; 315 | 316 | next if $rawfunc =~ /^\(/; # skip process names 317 | 318 | my $is_unknown=0; 319 | my @inline; 320 | for (split /\->/, $rawfunc) { 321 | my $func = $_; 322 | 323 | if ($func eq "[unknown]") { 324 | if ($mod ne "[unknown]") { # use module name instead, if known 325 | $func = $mod; 326 | $func =~ s/.*\///; 327 | } else { 328 | $func = "unknown"; 329 | $is_unknown=1; 330 | } 331 | 332 | if ($include_addrs) { 333 | $func = "\[$func \<$pc\>\]"; 334 | } else { 335 | $func = "\[$func\]"; 336 | } 337 | } 338 | 339 | if ($tidy_generic) { 340 | $func =~ s/;/:/g; 341 | if ($func !~ m/\.\(.*\)\./) { 342 | # This doesn't look like a Go method name (such as 343 | # "net/http.(*Client).Do"), so everything after the first open 344 | # paren (that is not part of an "(anonymous namespace)") is 345 | # just noise. 346 | $func =~ s/\((?!anonymous namespace\)).*//; 347 | } 348 | # now tidy this horrible thing: 349 | # 13a80b608e0a RegExp:[&<>\"\'] (/tmp/perf-7539.map) 350 | $func =~ tr/"\'//d; 351 | # fall through to $tidy_java 352 | } 353 | 354 | if ($tidy_java and $pname eq "java") { 355 | # along with $tidy_generic, converts the following: 356 | # Lorg/mozilla/javascript/ContextFactory;.call(Lorg/mozilla/javascript/ContextAction;)Ljava/lang/Object; 357 | # Lorg/mozilla/javascript/ContextFactory;.call(Lorg/mozilla/javascript/C 358 | # Lorg/mozilla/javascript/MemberBox;.(Ljava/lang/reflect/Method;)V 359 | # into: 360 | # org/mozilla/javascript/ContextFactory:.call 361 | # org/mozilla/javascript/ContextFactory:.call 362 | # org/mozilla/javascript/MemberBox:.init 363 | $func =~ s/^L// if $func =~ m:/:; 364 | } 365 | 366 | # 367 | # Annotations 368 | # 369 | # detect inlined from the @inline array 370 | # detect kernel from the module name; eg, frames to parse include: 371 | # ffffffff8103ce3b native_safe_halt ([kernel.kallsyms]) 372 | # 8c3453 tcp_sendmsg (/lib/modules/4.3.0-rc1-virtual/build/vmlinux) 373 | # 7d8 ipv4_conntrack_local+0x7f8f80b8 ([nf_conntrack_ipv4]) 374 | # detect jit from the module name; eg: 375 | # 7f722d142778 Ljava/io/PrintStream;::print (/tmp/perf-19982.map) 376 | if (scalar(@inline) > 0) { 377 | $func .= "_[i]"; # inlined 378 | } elsif ($annotate_kernel == 1 && $mod =~ m/(^\[|vmlinux$)/ && $mod !~ /unknown/) { 379 | $func .= "_[k]"; # kernel 380 | } elsif ($annotate_jit == 1 && $mod =~ m:/tmp/perf-\d+\.map:) { 381 | $func .= "_[j]"; # jitted 382 | } 383 | 384 | # 385 | # Source lines 386 | # 387 | # 388 | # Sample outputs: 389 | # | a.out 35081 252436.005167: 667783 cycles: 390 | # | 408ebb some_method_name+0x8b (/full/path/to/a.out) 391 | # | uniform_int_dist.h:300 392 | # | 4069f5 main+0x935 (/full/path/to/a.out) 393 | # | file.cpp:137 394 | # | 7f6d2148eb25 __libc_start_main+0xd5 (/lib64/libc-2.33.so) 395 | # | libc-2.33.so[27b25] 396 | # 397 | # | a.out 35081 252435.738165: 306459 cycles: 398 | # | 7f6d213c2750 [unknown] (/usr/lib64/libkmod.so.2.3.6) 399 | # | libkmod.so.2.3.6[6750] 400 | # 401 | # | a.out 35081 252435.738373: 315813 cycles: 402 | # | 7f6d215ca51b __strlen_avx2+0x4b (/lib64/libc-2.33.so) 403 | # | libc-2.33.so[16351b] 404 | # | 7ffc71ee9580 [unknown] ([unknown]) 405 | # | 406 | # 407 | # | a.out 35081 252435.718940: 247984 cycles: 408 | # | ffffffff814f9302 up_write+0x32 ([kernel.kallsyms]) 409 | # | [kernel.kallsyms][ffffffff814f9302] 410 | if($srcline_in_input and not $is_unknown){ 411 | $_ = <>; 412 | chomp; 413 | s/\[.*?\]//g; 414 | s/^\s*//g; 415 | s/\s*$//g; 416 | $func.=':'.$_ unless $_ eq ""; 417 | } 418 | 419 | push @inline, $func; 420 | } 421 | 422 | unshift @stack, @inline; 423 | } else { 424 | warn "Unrecognized line: $_"; 425 | } 426 | } 427 | 428 | foreach my $k (sort { $a cmp $b } keys %collapsed) { 429 | print "$k $collapsed{$k}\n"; 430 | } 431 | -------------------------------------------------------------------------------- /bin/.local/scripts/tmux-cht.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | selected=`cat ~/.tmux-cht-languages ~/.tmux-cht-command | fzf` 3 | if [[ -z $selected ]]; then 4 | exit 0 5 | fi 6 | 7 | read -p "Enter Query: " query 8 | 9 | if grep -qs "$selected" ~/.tmux-cht-languages; then 10 | query=`echo $query | tr ' ' '+'` 11 | tmux neww bash -c "echo \"curl cht.sh/$selected/$query/\" & curl cht.sh/$selected/$query & while [ : ]; do sleep 1; done" 12 | else 13 | tmux neww bash -c "curl -s cht.sh/$selected~$query | less" 14 | fi 15 | 16 | -------------------------------------------------------------------------------- /bin/.local/scripts/tmux-nrdp: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | nrdp_commands() { 4 | 5 | branch_name=$(basename $1) 6 | nrdp="$NRDP/$branch_name" 7 | build="$NRDP_BUILDS/$branch_name" 8 | 9 | mkdir -p $build 10 | cd $build 11 | 12 | # configure the damn script 13 | if [ "$2" != "just-build" ]; then 14 | pushd $nrdp 15 | git submodule update 16 | popd 17 | 18 | $nrdp/configure $(projector --pwd $nrdp configure) 19 | rm $nrdp/compile_commands.json 20 | cp compile_commands.json $nrdp 21 | fi 22 | 23 | # build netflix 24 | $(projector build) 25 | 26 | if [ "$2" != "just-build" ]; then 27 | notify-send --icon=gtk-info "NRDP Build $branch_name" "has completed" 28 | else 29 | notify-send --icon=gtk-info "NRDP Build $branch_name" "has been configured and built" 30 | fi 31 | } 32 | 33 | case "$1" in 34 | "tmux") 35 | 36 | session_name=$(tmux display-message -p '#S'); 37 | clean_arg=$(basename $2 | tr '/.' '__') 38 | target="$session_name:$clean_arg" 39 | 40 | if ! tmux has-session -t $target; then 41 | tmux neww -dn $clean_arg 42 | fi 43 | tmux send-keys -t $target "tmux-nrdp $2 $3 " 44 | ;; 45 | *) 46 | nrdp_commands $1 $2 47 | ;; 48 | esac 49 | 50 | -------------------------------------------------------------------------------- /bin/.local/scripts/tmux-sessionizer: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if [[ $# -eq 1 ]]; then 4 | selected=$1 5 | else 6 | selected=$(find ~/work/builds ~/projects ~/ ~/work ~/personal ~/personal/yt -mindepth 1 -maxdepth 1 -type d | fzf) 7 | fi 8 | 9 | if [[ -z $selected ]]; then 10 | exit 0 11 | fi 12 | 13 | selected_name=$(basename "$selected" | tr . _) 14 | tmux_running=$(pgrep tmux) 15 | 16 | if [[ -z $TMUX ]] && [[ -z $tmux_running ]]; then 17 | tmux new-session -s $selected_name -c $selected 18 | exit 0 19 | fi 20 | 21 | if ! tmux has-session -t=$selected_name 2> /dev/null; then 22 | tmux new-session -ds $selected_name -c $selected 23 | fi 24 | 25 | tmux switch-client -t $selected_name 26 | -------------------------------------------------------------------------------- /bin/.local/scripts/tmux-tvui: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | tmux-windowizer client  3 | tmux-windowizer server  4 | 5 | branch_name=$(basename $1) 6 | tmux-windowizer client cd $branch_name 7 | tmux-windowizer client ./tvui client 8 | 9 | tmux-windowizer server cd $branch_name 10 | tmux-windowizer server ./tvui server 11 | 12 | 13 | -------------------------------------------------------------------------------- /bin/.local/scripts/tmux-windowizer: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | branch_name=$(basename $1) 4 | session_name=$(tmux display-message -p "#S") 5 | clean_name=$(echo $branch_name | tr "./" "__") 6 | target="$session_name:$clean_name" 7 | 8 | if ! tmux has-session -t $target 2> /dev/null; then 9 | tmux neww -dn $clean_name 10 | fi 11 | 12 | shift 13 | tmux send-keys -t $target "$* " 14 | -------------------------------------------------------------------------------- /bin/.local/scripts/typer: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | xdotool type --delay 75 "cat /dev/ttyACM3" 3 | 4 | -------------------------------------------------------------------------------- /bin/.local/scripts/xrandr-oh-shit: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThePrimeagen/.dotfiles/602019e902634188ab06ea31251c01c1a43d1621/bin/.local/scripts/xrandr-oh-shit -------------------------------------------------------------------------------- /clean-env: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # I am using zsh instead of bash. I was having some troubles using bash with 3 | # arrays. Didn't want to investigate, so I just did zsh 4 | pushd $DOTFILES 5 | for folder in $(echo $STOW_FOLDERS | sed "s/,/ /g") 6 | do 7 | echo "Removing $folder" 8 | stow -D $folder 9 | done 10 | popd 11 | -------------------------------------------------------------------------------- /i3/.config/i3/config: -------------------------------------------------------------------------------- 1 | # This file has been auto-generated by i3-config-wizard(1). 2 | # It will not be overwritten, so edit it as you like. 3 | # 4 | # Should you change your keyboard layout some time, delete 5 | # this file and re-run i3-config-wizard(1). 6 | # 7 | 8 | # i3 config file (v4) 9 | # 10 | # Please see http://i3wm.org/docs/userguide.html for a complete reference! 11 | 12 | set $mod Mod1 13 | 14 | # Font for window titles. Will also be used by the bar unless a different font 15 | # is used in the bar {} block below. 16 | font pango:monospace 15px 17 | 18 | # GET DEM BORDERS OUT OF HEREc:w 19 | # 20 | # Thanks Childz 21 | for_window [class="^.*"] border pixel 2 22 | # class border backgr. text indicator child_border 23 | for_window [class="^.*"] client.focused #77dd77 #285577 #ffffff #2e9ef4 #285577 24 | 25 | # This font is widely installed, provides lots of unicode glyphs, right-to-left 26 | # text rendering and scalability on retina/hidpi displays (thanks to pango). 27 | #font pango:DejaVu Sans Mono 8 28 | 29 | # Before i3 v4.8, we used to recommend this one as the default: 30 | # font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 31 | # The font above is very space-efficient, that is, it looks good, sharp and 32 | # clear in small sizes. However, its unicode glyph coverage is limited, the old 33 | # X core fonts rendering does not support right-to-left and this being a bitmap 34 | # font, it doesn’t scale on retina/hidpi displays. 35 | 36 | # Use Mouse+$mod to drag floating windows to their wanted position 37 | floating_modifier $mod 38 | 39 | # start a terminal 40 | # bindsym $mod+Return exec i3-sensible-terminal 41 | bindsym $mod+Return exec i3-sensible-terminal 42 | 43 | # kill focused window 44 | # bindsym $mod+space exec "/home/theprimeagen/dotfiles/awesome-streamerrc/ThePrimeagen/tmux2" 45 | 46 | bindsym $mod+Shift+q kill 47 | 48 | # start dmenu (a program launcher) 49 | bindsym $mod+d exec --no-startup-id i3-dmenu-desktop 50 | 51 | # There also is the (new) i3-dmenu-desktop which only displays applications 52 | # shipping a .desktop file. It is a wrapper around dmenu, so you need that 53 | # installed. 54 | # bindsym $mod+d exec --no-startup-id i3-dmenu-desktop 55 | 56 | # change focus 57 | bindsym $mod+h focus left 58 | bindsym $mod+j focus down 59 | bindsym $mod+k focus up 60 | bindsym $mod+l focus right 61 | 62 | # alternatively, you can use the cursor keys: 63 | bindsym $mod+Left focus left 64 | bindsym $mod+Down focus down 65 | bindsym $mod+Up focus up 66 | bindsym $mod+Right focus right 67 | 68 | # move focused window 69 | bindsym $mod+Shift+h move left 70 | bindsym $mod+Shift+j move down 71 | bindsym $mod+Shift+k move up 72 | bindsym $mod+Shift+l move right 73 | 74 | # alternatively, you can use the cursor keys: 75 | bindsym $mod+Shift+Left move left 76 | bindsym $mod+Shift+Down move down 77 | bindsym $mod+Shift+Up move up 78 | bindsym $mod+Shift+Right move right 79 | 80 | # split in horizontal orientation 81 | bindsym $mod+z split h 82 | 83 | # split in vertical orientation 84 | bindsym $mod+v split v 85 | 86 | # enter fullscreen mode for the focused container 87 | bindsym $mod+f fullscreen toggle 88 | 89 | # change container layout (stacked, tabbed, toggle split) 90 | bindsym $mod+s layout stacking 91 | bindsym $mod+w layout tabbed 92 | bindsym $mod+e layout toggle split 93 | 94 | # toggle tiling / floating 95 | bindsym $mod+Shift+space floating toggle 96 | 97 | # focus the parent container 98 | bindsym $mod+a focus parent 99 | 100 | # focus the child container 101 | #bindsym $mod+d focus child 102 | 103 | # # switch to workspace 104 | bindsym $mod+1 workspace 1 105 | bindsym $mod+2 workspace 2 106 | bindsym $mod+3 workspace 3 107 | bindsym $mod+4 workspace 4 108 | bindsym $mod+5 workspace 5 109 | bindsym $mod+6 workspace 6 110 | bindsym $mod+7 workspace 7 111 | bindsym $mod+8 workspace 8 112 | bindsym $mod+9 workspace 9 113 | bindsym $mod+0 workspace 10 114 | 115 | # move focused container to workspace 116 | bindsym $mod+Shift+1 move container to workspace 1 117 | bindsym $mod+Shift+2 move container to workspace 2 118 | bindsym $mod+Shift+3 move container to workspace 3 119 | bindsym $mod+Shift+4 move container to workspace 4 120 | bindsym $mod+Shift+5 move container to workspace 5 121 | bindsym $mod+Shift+6 move container to workspace 6 122 | bindsym $mod+Shift+7 move container to workspace 7 123 | bindsym $mod+Shift+8 move container to workspace 8 124 | bindsym $mod+Shift+9 move container to workspace 9 125 | bindsym $mod+Shift+0 move container to workspace 10 126 | 127 | # NOTE: This is some real tom fooliery with my keyboard layout 128 | # ZMK will send a shift mod with the items that require a shift key on a 129 | # regular keyboard. so though it defines a keycode as "LEFT_BRACE" it really 130 | # is shift_L + LEFT_BRACE. So you will notice the odd peppering of shifts and 131 | # non shifts 132 | # switch to workspace 133 | # bindsym $mod+Shift+plus workspace 1 134 | # bindsym $mod+bracketleft workspace 2 135 | # bindsym $mod+Shift+braceleft workspace 3 136 | # bindsym $mod+Shift+parenleft workspace 4 137 | # bindsym $mod+Shift+ampersand workspace 5 138 | # bindsym $mod+equal workspace 6 139 | # bindsym $mod+Shift+parenright workspace 7 140 | # bindsym $mod+Shift+braceright workspace 8 141 | # bindsym $mod+bracketright workspace 9 142 | # bindsym $mod+Shift+asterisk workspace 10 143 | # 144 | # # NOTE: since i have to press shift to get these symbols 145 | # # move focused container to workspace. 146 | # # I wanted to use this as my method of moving spaces around, but it doesn't 147 | # # seem to work, but when i provide the keycode + shift it seems to work well. 148 | # # bindsym $mod+Shift+kp_1 move container to workspace 1 149 | # # bindsym $mod+Shift+kp_2 move container to workspace 2 150 | # # bindsym $mod+Shift+kp_3 move container to workspace 3 151 | # # bindsym $mod+Shift+kp_4 move container to workspace 4 152 | # # bindsym $mod+Shift+kp_5 move container to workspace 5 153 | # # bindsym $mod+Shift+kp_6 move container to workspace 6 154 | # # bindsym $mod+Shift+kp_7 move container to workspace 7 155 | # # bindsym $mod+Shift+kp_8 move container to workspace 8 156 | # # bindsym $mod+Shift+kp_9 move container to workspace 9 157 | # # bindsym $mod+Shift+kp_0 move container to workspace 10 158 | # 159 | # bindcode $mod+Shift+87 move container to workspace 1 160 | # bindcode $mod+Shift+88 move container to workspace 2 161 | # bindcode $mod+Shift+89 move container to workspace 3 162 | # bindcode $mod+Shift+83 move container to workspace 4 163 | # bindcode $mod+Shift+84 move container to workspace 5 164 | # bindcode $mod+Shift+85 move container to workspace 6 165 | # bindcode $mod+Shift+79 move container to workspace 7 166 | # bindcode $mod+Shift+80 move container to workspace 8 167 | # bindcode $mod+Shift+81 move container to workspace 9 168 | # bindcode $mod+Shift+90 move container to workspace 10 169 | 170 | # reload the configuration file 171 | bindsym $mod+Shift+c reload 172 | # restart i3 inplace (preserves your layout/session, can be used to upgrade i3) 173 | bindsym $mod+Shift+r restart 174 | # exit i3 (logs you out of your X session) 175 | bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'" 176 | 177 | # resize window (you can also use the mouse for that) 178 | mode "resize" { 179 | # These bindings trigger as soon as you enter the resize mode 180 | 181 | # Pressing left will shrink the window’s width. 182 | # Pressing right will grow the window’s width. 183 | # Pressing up will shrink the window’s height. 184 | # Pressing down will grow the window’s height. 185 | bindsym h resize shrink width 10 px or 10 ppt 186 | bindsym j resize grow height 10 px or 10 ppt 187 | bindsym k resize shrink height 10 px or 10 ppt 188 | bindsym l resize grow width 10 px or 10 ppt 189 | 190 | # same bindings, but for the arrow keys 191 | bindsym Left resize shrink width 10 px or 10 ppt 192 | bindsym Down resize grow height 10 px or 10 ppt 193 | bindsym Up resize shrink height 10 px or 10 ppt 194 | bindsym Right resize grow width 10 px or 10 ppt 195 | 196 | # back to normal: Enter or Escape 197 | bindsym Return mode "default" 198 | bindsym Escape mode "default" 199 | } 200 | 201 | bindsym $mod+r mode "resize" 202 | 203 | # Start i3bar to display a workspace bar (plus the system information i3status 204 | # finds out, if available) 205 | bar { 206 | status_command i3status 207 | tray_output primary 208 | } 209 | 210 | # ------------------------------------------ 211 | # CUSTOM KEYS START 212 | # ------------------------------------------ 213 | exec --no-startup-id nm-applet 214 | 215 | bindsym $mod+Shift+s exec --no-startup-id ~/dotfiles/bin/monitor 216 | bindsym $mod+Shift+n exec --no-startup-id ~/dotfiles/bin/resolution 217 | 218 | # FKeys 219 | # Pulse Audio controls 220 | bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume 0 +5% #increase sound volume 221 | bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume 0 -5% #decrease sound volume 222 | bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute 0 toggle # mute sound 223 | # 224 | # # Sreen brightness controls 225 | bindsym XF86MonBrightnessUp exec xbacklight -inc 20 # increase screen brightness 226 | bindsym XF86MonBrightnessDown exec xbacklight -dec 20 # decrease screen brightness 227 | 228 | # Alsa audio controls. 229 | bindsym $mod+Shift+comma exec ~/.config/i3/scripts/alsa restore 230 | bindsym $mod+semicolon exec ~/.config/i3/scripts/alsa down Headphone 231 | bindsym $mod+comma exec ~/.config/i3/scripts/alsa up Headphone 232 | bindsym $mod+m move workspace to output left 233 | 234 | # Suspend 235 | bindsym $mod+Shift+period exec systemctl suspend 236 | 237 | -------------------------------------------------------------------------------- /i3/.config/i3status/config: -------------------------------------------------------------------------------- 1 | # i3status configuration file. 2 | # see "man i3status" for documentation. 3 | 4 | # It is important that this file is edited as UTF-8. 5 | # The following line should contain a sharp s: 6 | # ß 7 | # If the above line is not correctly displayed, fix your editor first! 8 | 9 | general { 10 | colors = true 11 | interval = 5 12 | } 13 | 14 | order += "disk /" 15 | order += "battery all" 16 | order += "load" 17 | order += "tztime local" 18 | 19 | battery all { 20 | format = "%status %percentage %remaining" 21 | } 22 | 23 | tztime local { 24 | format = "%Y-%m-%d %H:%M:%S" 25 | } 26 | 27 | load { 28 | format = "%1min" 29 | } 30 | 31 | disk "/" { 32 | format = "%avail" 33 | } 34 | 35 | -------------------------------------------------------------------------------- /install: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # I am using zsh instead of bash. I was having some troubles using bash with 3 | # arrays. Didn't want to investigate, so I just did zsh 4 | pushd $DOTFILES 5 | for folder in $(echo $STOW_FOLDERS | sed "s/,/ /g") 6 | do 7 | echo "stow $folder" 8 | stow -D $folder 9 | stow $folder 10 | done 11 | popd 12 | 13 | pushd ./netflix 14 | ./stow 15 | popd 16 | 17 | -------------------------------------------------------------------------------- /layout.bak: -------------------------------------------------------------------------------- 1 | {1}>{s9}{-lshf}{eql}{+lshf} 2 | {1}{lshf}>{s9}{1} 3 | {1}{rshf}>{s9}{1} 4 | 5 | {2}>{s9}{obrk} 6 | {2}{lshf}>{s9}{2} 7 | {2}{rshf}>{s9}{2} 8 | 9 | {3}>{s9}{-lshf}{obrk}{+lshf} 10 | {3}{lshf}>{s9}{3} 11 | {3}{rshf}>{s9}{3} 12 | 13 | {4}>{s9}{-lshf}{9}{+lshf} 14 | {4}{lshf}>{s9}{4} 15 | {4}{rshf}>{s9}{4} 16 | 17 | {5}>{s9}{-lshf}{7}{+lshf} 18 | {5}{lshf}>{s9}{5} 19 | {5}{rshf}>{s9}{5} 20 | 21 | {6}>{s9}{eql} 22 | {6}{lshf}>{s9}{6} 23 | {6}{rshf}>{s9}{6} 24 | 25 | {7}>{s9}{-lshf}{0}{+lshf} 26 | {7}{lshf}>{s9}{7} 27 | {7}{rshf}>{s9}{7} 28 | 29 | {8}>{s9}{-lshf}{cbrk}{+lshf} 30 | {8}{lshf}>{s9}{8} 31 | {8}{rshf}>{s9}{8} 32 | 33 | {9}>{s9}{-lshf}{cbrk}{+lshf} 34 | {9}{lshf}>{s9}{9} 35 | {9}{rshf}>{s9}{9} 36 | 37 | {0}>{s9}{-lshf}{8}{+lshf} 38 | {0}{lshf}>{s9}{0} 39 | {0}{rshf}>{s9}{0} 40 | 41 | {hyph}>{s9}{-lshf}{1}{+lshf} 42 | {hyph}{lshf}>{s9}{-lshf}{5}{+lshf} 43 | {hyph}{rshf}>{s9}{-lshf}{5}{+lshf} 44 | 45 | 46 | -------------------------------------------------------------------------------- /layout.txt: -------------------------------------------------------------------------------- 1 | 2 | [q]>[scol] 3 | [w]>[com] 4 | [e]>[per] 5 | [r]>[p] 6 | [t]>[y] 7 | [s]>[o] 8 | [d]>[e] 9 | [f]>[u] 10 | [g]>[i] 11 | [z]>[apos] 12 | [x]>[q] 13 | [c]>[j] 14 | [v]>[k] 15 | [b]>[x] 16 | [y]>[f] 17 | [u]>[g] 18 | [i]>[c] 19 | [o]>[r] 20 | [p]>[l] 21 | [h]>[d] 22 | [j]>[h] 23 | [k]>[t] 24 | [l]>[n] 25 | [n]>[b] 26 | [com]>[w] 27 | [per]>[v] 28 | [fsls]>[z] 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /project.json: -------------------------------------------------------------------------------- 1 | { 2 | "nrdp": { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /test2/.config/personal/test: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThePrimeagen/.dotfiles/602019e902634188ab06ea31251c01c1a43d1621/test2/.config/personal/test -------------------------------------------------------------------------------- /tmux/.tmux-cht-command: -------------------------------------------------------------------------------- 1 | find 2 | man 3 | tldr 4 | sed 5 | awk 6 | tr 7 | cp 8 | ls 9 | grep 10 | xargs 11 | rg 12 | ps 13 | mv 14 | kill 15 | lsof 16 | less 17 | head 18 | tail 19 | tar 20 | cp 21 | rm 22 | rename 23 | jq 24 | cat 25 | ssh 26 | cargo 27 | git 28 | git-worktree 29 | git-status 30 | git-commit 31 | git-rebase 32 | docker 33 | docker-compose 34 | stow 35 | chmod 36 | chown 37 | make 38 | -------------------------------------------------------------------------------- /tmux/.tmux-cht-languages: -------------------------------------------------------------------------------- 1 | golang 2 | solidity 3 | vlang 4 | v 5 | nodejs 6 | javascript 7 | tmux 8 | typescript 9 | zsh 10 | cpp 11 | c 12 | lua 13 | rust 14 | python 15 | bash 16 | php 17 | haskell 18 | ArnoldC 19 | css 20 | html 21 | gdb 22 | -------------------------------------------------------------------------------- /tmux/.tmux.conf: -------------------------------------------------------------------------------- 1 | set -ga terminal-overrides ",screen-256color*:Tc" 2 | set-option -g default-terminal "screen-256color" 3 | set -s escape-time 0 4 | 5 | unbind C-b 6 | set-option -g prefix C-a 7 | bind-key C-a send-prefix 8 | set -g status-style 'bg=#333333 fg=#5eacd3' 9 | 10 | bind r source-file ~/.tmux.conf 11 | set -g base-index 1 12 | 13 | set-window-option -g mode-keys vi 14 | bind -T copy-mode-vi v send-keys -X begin-selection 15 | bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard' 16 | 17 | # vim-like pane switching 18 | bind -r ^ last-window 19 | bind -r k select-pane -U 20 | bind -r j select-pane -D 21 | bind -r h select-pane -L 22 | bind -r l select-pane -R 23 | 24 | bind -r D neww -c "#{pane_current_path}" "[[ -e TODO.md ]] && nvim TODO.md || nvim ~/.dotfiles/personal/todo.md" 25 | 26 | # forget the find window. That is for chumps 27 | bind-key -r f run-shell "tmux neww ~/.local/bin/tmux-sessionizer" 28 | 29 | bind-key -r i run-shell "tmux neww tmux-cht.sh" 30 | bind-key -r G run-shell "~/.local/bin/tmux-sessionizer ~/work/nrdp" 31 | bind-key -r C run-shell "~/.local/bin/tmux-sessionizer ~/work/tvui" 32 | bind-key -r R run-shell "~/.local/bin/tmux-sessionizer ~/work/milo" 33 | # bind-key -r L run-shell "~/.local/bin/tmux-sessionizer ~/work/hpack" 34 | bind-key -r H run-shell "~/.local/bin/tmux-sessionizer ~/personal/vim-with-me" 35 | bind-key -r T run-shell "~/.local/bin/tmux-sessionizer ~/personal/refactoring.nvim" 36 | bind-key -r N run-shell "~/.local/bin/tmux-sessionizer ~/personal/harpoon" 37 | bind-key -r S run-shell "~/.local/bin/tmux-sessionizer ~/personal/developer-productivity" 38 | -------------------------------------------------------------------------------- /tree-sitter/.config/tree-sitter/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "parser-directories": [ 3 | "/home/theprimeagen/.config/tree-sitter/tree-sitter-lua" 4 | ], 5 | "theme": { 6 | "tag": 18, 7 | "function": 26, 8 | "string.special": 30, 9 | "punctuation.bracket": 239, 10 | "punctuation.delimiter": 239, 11 | "embedded": null, 12 | "function.builtin": { 13 | "color": 26, 14 | "bold": true 15 | }, 16 | "constant.builtin": { 17 | "color": 94, 18 | "bold": true 19 | }, 20 | "constant": 94, 21 | "operator": { 22 | "bold": true, 23 | "color": 239 24 | }, 25 | "string": 28, 26 | "variable.builtin": { 27 | "bold": true 28 | }, 29 | "variable.parameter": { 30 | "underline": true 31 | }, 32 | "type": 23, 33 | "keyword": 56, 34 | "number": { 35 | "bold": true, 36 | "color": 94 37 | }, 38 | "constructor": 136, 39 | "property": 124, 40 | "type.builtin": { 41 | "bold": true, 42 | "color": 23 43 | }, 44 | "comment": { 45 | "color": 245, 46 | "italic": true 47 | }, 48 | "attribute": { 49 | "color": 124, 50 | "italic": true 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /ubuntu: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | if [[ -z $STOW_FOLDERS ]]; then 3 | STOW_FOLDERS="bin,i3,netflix,nvim,personal,tmux,uwuntu,xkb,zsh" 4 | fi 5 | 6 | if [[ -z $DOTFILES ]]; then 7 | DOTFILES=$HOME/.dotfiles 8 | fi 9 | 10 | STOW_FOLDERS=$STOW_FOLDERS DOTFILES=$DOTFILES $DOTFILES/install 11 | 12 | -------------------------------------------------------------------------------- /uwuntu/.config/.nvidia-settings-rc: -------------------------------------------------------------------------------- 1 | # 2 | # /home/theprimeagen/.dotfiles/uwuntu/.config/.nvidia-settings-rc 3 | # 4 | # Configuration file for nvidia-settings - the NVIDIA X Server Settings utility 5 | # Generated on Mon Nov 1 08:23:02 2021 6 | # 7 | 8 | # ConfigProperties: 9 | 10 | RcFileLocale = C 11 | DisplayStatusBar = Yes 12 | SliderTextEntries = Yes 13 | IncludeDisplayNameInConfigFile = No 14 | ShowQuitDialog = Yes 15 | UpdateRulesOnProfileNameChange = Yes 16 | Timer = Memory_Used_(GPU_0),Yes,3000 17 | Timer = Thermal_Monitor_(GPU_0),Yes,1000 18 | Timer = PowerMizer_Monitor_(GPU_0),Yes,1000 19 | 20 | # Attributes: 21 | 22 | 0/SyncToVBlank=1 23 | 0/LogAniso=4 24 | 0/FSAA=0 25 | 0/TextureClamping=1 26 | 0/FXAA=1 27 | 0/AllowFlipping=1 28 | 0/FSAAAppControlled=1 29 | 0/LogAnisoAppControlled=0 30 | 0/OpenGLImageSettings=0 31 | 0/FSAAAppEnhanced=0 32 | 0/ShowGraphicsVisualIndicator=0 33 | [DPY:DVI-D-0]/Dithering=0 34 | [DPY:DVI-D-0]/DitheringMode=0 35 | [DPY:DVI-D-0]/DitheringDepth=0 36 | [DPY:DVI-D-0]/ColorSpace=0 37 | [DPY:DVI-D-0]/ColorRange=0 38 | [DPY:DVI-D-0]/SynchronousPaletteUpdates=0 39 | [DPY:HDMI-0]/RedBrightness=0.000000 40 | [DPY:HDMI-0]/GreenBrightness=0.000000 41 | [DPY:HDMI-0]/BlueBrightness=0.000000 42 | [DPY:HDMI-0]/RedContrast=0.000000 43 | [DPY:HDMI-0]/GreenContrast=0.000000 44 | [DPY:HDMI-0]/BlueContrast=0.000000 45 | [DPY:HDMI-0]/RedGamma=1.000000 46 | [DPY:HDMI-0]/GreenGamma=1.000000 47 | [DPY:HDMI-0]/BlueGamma=1.000000 48 | [DPY:HDMI-0]/Dithering=0 49 | [DPY:HDMI-0]/DitheringMode=0 50 | [DPY:HDMI-0]/DitheringDepth=0 51 | [DPY:HDMI-0]/DigitalVibrance=0 52 | [DPY:HDMI-0]/ColorSpace=0 53 | [DPY:HDMI-0]/ColorRange=0 54 | [DPY:HDMI-0]/SynchronousPaletteUpdates=0 55 | [DPY:DP-0]/Dithering=0 56 | [DPY:DP-0]/DitheringMode=0 57 | [DPY:DP-0]/DitheringDepth=0 58 | [DPY:DP-0]/ColorSpace=0 59 | [DPY:DP-0]/ColorRange=0 60 | [DPY:DP-0]/SynchronousPaletteUpdates=0 61 | [DPY:DP-1]/Dithering=0 62 | [DPY:DP-1]/DitheringMode=0 63 | [DPY:DP-1]/DitheringDepth=0 64 | [DPY:DP-1]/ColorSpace=0 65 | [DPY:DP-1]/ColorRange=0 66 | [DPY:DP-1]/SynchronousPaletteUpdates=0 67 | -------------------------------------------------------------------------------- /uwuntu/.config/personal/alias: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | alias asdf="setxkbmap real-prog-dvorak" 3 | alias aoeu="setxkbmap us" 4 | alias lkj="setxkbmap real-prog-dvorak" 5 | alias snth="setxkbmap us" 6 | alias xsc="xclip -selection clipboard" 7 | alias my_ip="ip address | grep -o \"inet 192.*/\" | awk '{ print \$2 }' | tr / ' ' | xargs" 8 | 9 | #!/usr/bin/env bash 10 | alias esc="$HOME/.config/sway/config" 11 | alias vim="$VIM" 12 | alias vims="NVIM_LISTEN_ADDRESS=/tmp/nvim $VIM" 13 | alias kill_netflix="pkill -9 GIBBON_MAIN" 14 | alias work="cd ~/work" 15 | 16 | alias python="python3" 17 | alias cbp="cat $DOTFILES/zsh/.config/.zsh_profile" 18 | alias ebp="$VIM $DOTFILES/.zsh_profile" 19 | alias etc="$VIM $DOTFILES/awesome-streamerrc/ThePrimeagen/.tmux.conf" 20 | alias bp="dotFileInstall && source ~/.zshrc" 21 | alias evrc="$VIM $DOTFILES/awesome-streamerrc/ThePrimeagen/.vimrc" 22 | alias enrc="nvim $DOTFILES/awesome-streamerrc/ThePrimeagen/init.vim --cmd \"cd $DOTFILES/awesome-streamerrc/ThePrimeagen/init.vim\"" 23 | alias yolo="git push origin master --force --no-verify" 24 | alias eirc="nvim $XDG_CONFIG_HOME/i3/i3config" 25 | alias cvrc="cat $DOTFILES/vimrc/.vimrc" 26 | alias dotFileInstall="$DOTFILES/install" 27 | 28 | alias pjson="python -mjson.tool" 29 | alias killBT="rfkill block bluetooth" 30 | alias unKillBT="rfkill unblock bluetooth" 31 | alias cclip="xclip -selection clipboard" 32 | alias pclip="xclip -selection clipboard" 33 | alias timeplus="~/dotfiles/apps/time_plus_30" 34 | alias echotime="~/dotfiles/apps/echo_time" 35 | alias livestream_screenkey="screenkey -s large --scr 2 -p bottom --geometry 1210x300+712+810"; 36 | alias yt_screenkey="screenkey -s large --scr 1 -p bottom --geometry 510x300+1412+850"; 37 | 38 | alias mynpm='rm ~/.npmrc' 39 | 40 | -------------------------------------------------------------------------------- /uwuntu/.config/personal/env: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | # Super cool keyboard stuffs. 4 | # Required for x applications 5 | setxkbmap -option caps:ctrl_modifier 6 | 7 | export STOW_FOLDERS="bin,nvim,tmux,uwuntu,netflix,personal,i3,zsh,xkb" 8 | 9 | startMongo() { 10 | sudo systemctl start mongod 11 | sudo systemctl enable mongod 12 | } 13 | 14 | increaseWatchers() { 15 | sudo sysctl fs.inotify.max_user_watches=65536 16 | sudo sysctl -p 17 | } 18 | 19 | change_background() { 20 | dconf write /org/mate/desktop/background/picture-filename "'$HOME/dotfiles/backgrounds/$(ls ~/dotfiles/backgrounds | fzf)'" 21 | } 22 | 23 | 24 | die () { 25 | echo >&2 "$@" 26 | exit 1 27 | } 28 | 29 | addToPath() { 30 | if [[ "$PATH" != *"$1"* ]]; then 31 | export PATH=$PATH:$1 32 | fi 33 | } 34 | 35 | addToPathFront() { 36 | if [[ "$PATH" != *"$1"* ]]; then 37 | export PATH=$1:$PATH 38 | fi 39 | } 40 | 41 | commitDotFiles() { 42 | pushd $DOTFILES 43 | pushd personal 44 | git add . 45 | git commit -m "automagic messaging from me in the past. Have you checked up your butthole?" 46 | git push origin master 47 | popd 48 | git add . 49 | git commit -m "automagic messaging from me in the past. Have you checked up your butthole?" 50 | git push origin master 51 | popd 52 | } 53 | -------------------------------------------------------------------------------- /uwuntu/.config/personal/paths: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | addToPathFront /home/theprimeagen/n/bin 3 | addToPathFront $DENO_INSTALL 4 | addToPath /home/theprimeagen/personal/lua-language-server/bin/Linux 5 | addToPath /usr/local/go/bin 6 | addToPath $GOPATH/bin 7 | addToPath $HOME/work/wrapper 8 | addToPath /usr/local/netflix/tvui-automation-analyzer 9 | addToPath /usr/local/netflix/encoders/bin/ 10 | addToPath $HOME/.yarn/bin 11 | addToPath /usr/lib/llvm-8/bin 12 | addToPath $HOME/personal/uhh/build 13 | addToPath $HOME/.cargo/bin 14 | addToPath $HOME/.rustup 15 | 16 | # ccache 17 | addToPathFront /usr/lib/ccache 18 | -------------------------------------------------------------------------------- /vim-2022/.config/nvim/after/plugin/foo.lua: -------------------------------------------------------------------------------- 1 | print("foo from after") 2 | 3 | -------------------------------------------------------------------------------- /vim-2022/.config/nvim/init.lua: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThePrimeagen/.dotfiles/602019e902634188ab06ea31251c01c1a43d1621/vim-2022/.config/nvim/init.lua -------------------------------------------------------------------------------- /vim-2022/.config/nvim/lua/theprimeagen/init.lua: -------------------------------------------------------------------------------- 1 | print("from theprimeagen"); 2 | 3 | require("theprimeagen.set"); 4 | 5 | -------------------------------------------------------------------------------- /vim-2022/.config/nvim/lua/theprimeagen/remap.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | function bind(op, outer_opts) 4 | outer_opts = outer_opts or {noremap = true} 5 | return function(lhs, rhs, opts) 6 | opts = vim.tbl_extend("force", 7 | outer_opts, 8 | opts or {} 9 | ) 10 | vim.keymap.set(op, lhs, rhs, opts) 11 | end 12 | end 13 | 14 | M.nmap = bind("n", {noremap = false}) 15 | M.nnoremap = bind("n") 16 | M.vnoremap = bind("v") 17 | M.xnoremap = bind("x") 18 | M.inoremap = bind("i") 19 | 20 | return M 21 | 22 | 23 | -------------------------------------------------------------------------------- /vim-2022/.config/nvim/lua/theprimeagen/set.lua: -------------------------------------------------------------------------------- 1 | vim.opt.tabstop = 4 2 | vim.opt.softtabstop = 4 3 | vim.opt.shiftwidth = 4 4 | vim.opt.expandtab = true 5 | -------------------------------------------------------------------------------- /vim-2022/.config/nvim/lua/theprimeagen/test.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | console.log("hello crappy formatting"); 3 | } 4 | 5 | -------------------------------------------------------------------------------- /xkb/.config/xkb/symbols/real-prog-dvorak: -------------------------------------------------------------------------------- 1 | xkb_symbols "real-prog-dvorak" { 2 | 3 | name[Group1]= "English (Real Programmers Dvorak)"; 4 | 5 | key { [ dollar, asciitilde, dead_grave, dead_tilde ] }; 6 | 7 | key { [ plus, 1 ] }; 8 | key { [ bracketleft, 2 ] }; 9 | key { [ braceleft, 3 ] }; 10 | key { [ parenleft, 4 ] }; 11 | key { [ ampersand, 5 ] }; 12 | key { [ equal, 6, dead_circumflex, dead_circumflex ] }; 13 | key { [ parenright, 7 ] }; 14 | key { [ braceright, 8 ] }; 15 | key { [ bracketright, 9, dead_grave] }; 16 | key { [ asterisk, 0 ] }; 17 | key { [ exclam, percent ] }; 18 | key { [ bar, grave, dead_tilde] }; 19 | 20 | key { [ semicolon, colon, dead_acute, dead_diaeresis ] }; 21 | key { [ comma, less, dead_cedilla, dead_caron ] }; 22 | key { [ period, greater, dead_abovedot, periodcentered ] }; 23 | key { [ p, P ] }; 24 | key { [ y, Y ] }; 25 | key { [ f, F ] }; 26 | key { [ g, G ] }; 27 | key { [ c, C ] }; 28 | key { [ r, R ] }; 29 | key { [ l, L ] }; 30 | key { [ slash, question ] }; 31 | key { [ at, asciicircum ] }; 32 | 33 | key { [ a, A ] }; 34 | key { [ o, O ] }; 35 | key { [ e, E ] }; 36 | key { [ u, U ] }; 37 | key { [ i, I ] }; 38 | key { [ d, D ] }; 39 | key { [ h, H ] }; 40 | key { [ t, T ] }; 41 | key { [ n, N ] }; 42 | key { [ s, S ] }; 43 | key { [ minus, underscore ] }; 44 | 45 | key { [ apostrophe, quotedbl, dead_ogonek, dead_doubleacute ] }; 46 | key { [ q, Q ] }; 47 | key { [ j, J ] }; 48 | key { [ k, K ] }; 49 | key { [ x, X ] }; 50 | key { [ b, B ] }; 51 | key { [ m, M ] }; 52 | key { [ w, W ] }; 53 | key { [ v, V ] }; 54 | key { [ z, Z ] }; 55 | 56 | key { [ backslash, numbersign ] }; 57 | }; 58 | -------------------------------------------------------------------------------- /zsh/.zsh_profile: -------------------------------------------------------------------------------- 1 | export XDG_CONFIG_HOME=$HOME/.config 2 | VIM="nvim" 3 | 4 | PERSONAL=$XDG_CONFIG_HOME/personal 5 | source $PERSONAL/env 6 | for i in `find -L $PERSONAL`; do 7 | source $i 8 | done 9 | source /usr/share/doc/fzf/examples/key-bindings.zsh 10 | source /usr/share/doc/fzf/examples/completion.zsh 11 | 12 | export NRDP="$HOME/work/nrdp" 13 | export NRDP_BUILDS="$HOME/work/builds" 14 | export CC="clang-12" 15 | export CXX="clang++-12" 16 | export PYTHONBREAKPOINT="pudb.set_trace" 17 | export GOPATH=$HOME/go 18 | export DARWINS_DIR="$HOME/work/darwins" 19 | export TVUI="$HOME/work/tvui" 20 | export API_TOOLS=$HOME/work/tools/edge/scripts 21 | export GIT_EDITOR=$VIM 22 | export EOSIO_INSTALL_DIR=$HOME/personal/eos 23 | export NF_IDFILE=$HOME/.idfile 24 | export DENO_INSTALL="$HOME/.deno" 25 | export N_PREFIX="$HOME/.local/n" 26 | export DOTFILES=$HOME/.dotfiles 27 | export BOGART=$HOME/work/bogart 28 | 29 | addToPathFront $HOME/.zig 30 | addToPathFront $HOME/.local/.npm-global/bin 31 | addToPathFront $HOME/.local/scripts 32 | addToPathFront $HOME/.local/bin 33 | addToPathFront $HOME/.local/n/bin/ 34 | addToPathFront $HOME/.local/go/bin 35 | addToPathFront $HOME/go/bin 36 | addToPathFront $HOME/personal/sumneko/bin 37 | addToPathFront $HOME/.deno/bin 38 | 39 | # Where should I put you? 40 | bindkey -s ^f "tmux-sessionizer\n" 41 | 42 | catr() { 43 | tail -n "+$1" $3 | head -n "$(($2 - $1 + 1))" 44 | } 45 | 46 | validateYaml() { 47 | python -c 'import yaml,sys;yaml.safe_load(sys.stdin)' < $1 48 | } 49 | 50 | goWork() { 51 | cp ~/.npm_work_rc ~/.npmrc 52 | } 53 | 54 | goPersonal() { 55 | cp ~/.npm_personal_rc ~/.npmrc 56 | } 57 | 58 | addThrottle() { 59 | local kbs="kbps" 60 | echo $kbs 61 | echo "About to throttle to $1 $kbs" 62 | echo "sudo tc qdisc add dev wlp59s0 handle 1: root htb default 11" 63 | echo "sudo tc class add dev wlp59s0 parent 1: classid 1:1 htb rate $1$kbs" 64 | echo "sudo tc class add dev wlp59s0 parent 1:1 classid 1:11 htb rate $1$kbs" 65 | sudo tc qdisc add dev wlp59s0 handle 1: root htb default 11 66 | sudo tc class add dev wlp59s0 parent 1: classid 1:1 htb rate $1$kbs 67 | sudo tc class add dev wlp59s0 parent 1:1 classid 1:11 htb rate $1$kbs 68 | } 69 | 70 | removeThrottle() { 71 | sudo tc qdisc del dev wlp59s0 root 72 | } 73 | 74 | cat1Line() { 75 | cat $1 | tr -d "\n" 76 | } 77 | 78 | ioloop() { 79 | FIFO=$(mktemp -u /tmp/ioloop_$$_XXXXXX ) && 80 | trap "rm -f $FIFO" EXIT && 81 | mkfifo $FIFO && 82 | ( : <$FIFO & ) && # avoid deadlock on opening pipe 83 | exec >$FIFO <$FIFO 84 | } 85 | 86 | eslintify() { 87 | cat $1 > /tmp/file_to_eslint 88 | npx eslint 89 | } 90 | -------------------------------------------------------------------------------- /zsh/.zshrc: -------------------------------------------------------------------------------- 1 | # If you come from bash you might have to change your $PATH. 2 | # export PATH=$HOME/bin:/usr/local/bin:$PATH 3 | 4 | # Path to your oh-my-zsh installation. 5 | export ZSH="$HOME/.oh-my-zsh" 6 | 7 | # Set name of the theme to load --- if set to "random", it will 8 | # load a random theme each time oh-my-zsh is loaded, in which case, 9 | # to know which specific one was loaded, run: echo $RANDOM_THEME 10 | # See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes 11 | ZSH_THEME="robbyrussell" 12 | 13 | # Set list of themes to pick from when loading at random 14 | # Setting this variable when ZSH_THEME=random will cause zsh to load 15 | # a theme from this variable instead of looking in $ZSH/themes/ 16 | # If set to an empty array, this variable will have no effect. 17 | # ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) 18 | 19 | # Uncomment the following line to use case-sensitive completion. 20 | # CASE_SENSITIVE="true" 21 | 22 | # Uncomment the following line to use hyphen-insensitive completion. 23 | # Case-sensitive completion must be off. _ and - will be interchangeable. 24 | # HYPHEN_INSENSITIVE="true" 25 | 26 | # Uncomment one of the following lines to change the auto-update behavior 27 | # zstyle ':omz:update' mode disabled # disable automatic updates 28 | # zstyle ':omz:update' mode auto # update automatically without asking 29 | # zstyle ':omz:update' mode reminder # just remind me to update when it's time 30 | 31 | # Uncomment the following line to change how often to auto-update (in days). 32 | # zstyle ':omz:update' frequency 13 33 | 34 | # Uncomment the following line if pasting URLs and other text is messed up. 35 | # DISABLE_MAGIC_FUNCTIONS="true" 36 | 37 | # Uncomment the following line to disable colors in ls. 38 | # DISABLE_LS_COLORS="true" 39 | 40 | # Uncomment the following line to disable auto-setting terminal title. 41 | # DISABLE_AUTO_TITLE="true" 42 | 43 | # Uncomment the following line to enable command auto-correction. 44 | # ENABLE_CORRECTION="true" 45 | 46 | # Uncomment the following line to display red dots whilst waiting for completion. 47 | # You can also set it to another string to have that shown instead of the default red dots. 48 | # e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f" 49 | # Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765) 50 | # COMPLETION_WAITING_DOTS="true" 51 | 52 | # Uncomment the following line if you want to disable marking untracked files 53 | # under VCS as dirty. This makes repository status check for large repositories 54 | # much, much faster. 55 | # DISABLE_UNTRACKED_FILES_DIRTY="true" 56 | 57 | # Uncomment the following line if you want to change the command execution time 58 | # stamp shown in the history command output. 59 | # You can set one of the optional three formats: 60 | # "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" 61 | # or set a custom format using the strftime function format specifications, 62 | # see 'man strftime' for details. 63 | # HIST_STAMPS="mm/dd/yyyy" 64 | 65 | # Would you like to use another custom folder than $ZSH/custom? 66 | # ZSH_CUSTOM=/path/to/new-custom-folder 67 | 68 | # Which plugins would you like to load? 69 | # Standard plugins can be found in $ZSH/plugins/ 70 | # Custom plugins may be added to $ZSH_CUSTOM/plugins/ 71 | # Example format: plugins=(rails git textmate ruby lighthouse) 72 | # Add wisely, as too many plugins slow down shell startup. 73 | plugins=(git) 74 | 75 | source $ZSH/oh-my-zsh.sh 76 | 77 | # User configuration 78 | 79 | # export MANPATH="/usr/local/man:$MANPATH" 80 | 81 | # You may need to manually set your language environment 82 | # export LANG=en_US.UTF-8 83 | 84 | # Preferred editor for local and remote sessions 85 | # if [[ -n $SSH_CONNECTION ]]; then 86 | # export EDITOR='vim' 87 | # else 88 | # export EDITOR='mvim' 89 | # fi 90 | 91 | # Compilation flags 92 | # export ARCHFLAGS="-arch x86_64" 93 | 94 | # Set personal aliases, overriding those provided by oh-my-zsh libs, 95 | # plugins, and themes. Aliases can be placed here, though oh-my-zsh 96 | # users are encouraged to define aliases within the ZSH_CUSTOM folder. 97 | # For a full list of active aliases, run `alias`. 98 | # 99 | # Example aliases 100 | # alias zshconfig="mate ~/.zshrc" 101 | # alias ohmyzsh="mate ~/.oh-my-zsh" 102 | source ~/.zsh_profile 103 | 104 | alias luamake=/home/mpaulson/personal/lua-language-server/3rd/luamake/luamake 105 | 106 | # bun completions 107 | [ -s "/home/mpaulson/.bun/_bun" ] && source "/home/mpaulson/.bun/_bun" 108 | 109 | # Bun 110 | export BUN_INSTALL="/home/mpaulson/.bun" 111 | export PATH="$BUN_INSTALL/bin:$PATH" 112 | 113 | # Bun 114 | export BUN_INSTALL="/home/mpaulson/.bun" 115 | export PATH="$BUN_INSTALL/bin:$PATH" 116 | 117 | # pnpm 118 | export PNPM_HOME="/home/mpaulson/.local/share/pnpm" 119 | export PATH="$PNPM_HOME:$PATH" 120 | # pnpm end 121 | # Turso 122 | export PATH="/home/mpaulson/.turso:$PATH" 123 | 124 | # >>> conda initialize >>> 125 | # !! Contents within this block are managed by 'conda init' !! 126 | __conda_setup="$('/home/mpaulson/.local/anaconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)" 127 | if [ $? -eq 0 ]; then 128 | eval "$__conda_setup" 129 | else 130 | if [ -f "/home/mpaulson/.local/anaconda3/etc/profile.d/conda.sh" ]; then 131 | . "/home/mpaulson/.local/anaconda3/etc/profile.d/conda.sh" 132 | else 133 | export PATH="/home/mpaulson/.local/anaconda3/bin:$PATH" 134 | fi 135 | fi 136 | unset __conda_setup 137 | # <<< conda initialize <<< 138 | 139 | --------------------------------------------------------------------------------