Skip to content

Instantly share code, notes, and snippets.


kehlarn teichopsia

View GitHub Profile
teichopsia / regex-trap
Last active Aug 29, 2015
[interview traps] how to properly scan a line of input for an ip address
View regex-trap
if you have an interviewer ask this question and they want a regex. get up and walk out the door. These goonies probably still use tn-3270, cobol and ftp (cutting edge). they also have no idea what regexes are for; how to anchor them; nor how not to expose excessive backreferencing, backtracking and other nfa promotions. they also probably have production code you can regex bomb or worse lfi.
at best the regex is used to capture the result that gets passed to a primitive designed to detaint/parse. go read up on the GHOST attacks if you think these are easy to write securely.
the only correct answer to anybody using a dynamic language is to invoke your libc binding for standard posixish primitives. bypassing these basically means you're ignoring how getaddrinfo modern resolution primitives work on dual stacks and generally taking a piss on ipv6. welcome to the 90s kid ipv6 is real. you're decades behind already in your regex. I dare you to write a correct folding implementation of ipv6 in a regex. Welcome ba
View infinite-loop-trick.log
$ cat test.js
function foo () { while (true) { } }
function bar () { return foo(); }
$ node test.js &
$ gdb attach $(pidof node)
0x00000bf778c63d5f in ?? ()
(gdb) b v8::internal::Runtime_StackGuard
Breakpoint 1 at 0x84a1f0
(gdb) print 'v8::V8::TerminateExecution'(0)
teichopsia /
Last active Dec 11, 2015
dump all keymap bindings for blender 2.65. the word 'key' here is in the colloquial sense as there are keyboard, mouse, and other map binding types. it's really an event dispatch mapping that happens to cover keyboards and other sources.
#there may be a better way to find keybindings but until I do, this will have to suffice...
#likewise, until i figure out blender addons proper, this will need to be pasted to the python console
import operator
import bpy
import os
teichopsia /
Created Jul 28, 2018 — forked from paivaric/
Google Analytics Proxy using Nginx to bypass Adblock and other blockers
server {
listen 80;
location = /analytics.js {
# you have to compile nginx with (this is not default)
# and (it's a default module)
proxy_set_header Accept-Encoding "";
teichopsia / powercfg-win7-all-settings.bat
Created May 10, 2019 — forked from theultramage/powercfg-win7-all-settings.bat
Show/hide all hidden settings in Win7 Power Options
View powercfg-win7-all-settings.bat
@echo off
REM Harddisk settings
powercfg -attributes 0012ee47-9041-4b5d-9b77-535fba8b1442 0b2d69d7-a2a1-449c-9680-f91c70521c60 %attrib%
powercfg -attributes 0012ee47-9041-4b5d-9b77-535fba8b1442 80e3c60e-bb94-4ad8-bbe0-0d3195efc663 %attrib%
powercfg -attributes 0012ee47-9041-4b5d-9b77-535fba8b1442 dab60367-53fe-4fbc-825e-521d069d2456 %attrib%
REM Sleep transition settings
View win7 unpark cpus
after upgrading to pro this feature reset my registry to park cpus. in windows7 the attribute is masked from the gui by default it seems so unhide it then you can modify it in the gui. the relevant guid doesnt work in powercfg directly for some reason though.
powercfg -attributes 54533251-82be-4824-96c1-47b60b740d00 0cc5b647-c1df-4637-891a-dec35c318583 -ATTRIB_HIDE
in windows server 2016 you can hit it directly of course:
Powercfg -setacvalueindex scheme_current sub_processor CPMINCORES 100
Powercfg -setacvalueindex scheme_current sub_processor CPMINCORES 100
Powercfg -setactive scheme_current
View netflix minimal
// ==UserScript==
// @name Netflix minimal
// @description netflix minimal attract mode // disable attract sound and purge attract mode elements
// @namespace
// @author kehlarn
// @homepageURL
// @version 1
// @match
// @grant none
// ==/UserScript==
teichopsia /
Created Nov 8, 2020 — forked from Chaser324/
GitHub Standard Fork & Pull Request Workflow

Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, it's quite easy to make mistakes or not know what you should do when you're initially learning the process. I know that I certainly had considerable initial trouble with it, and I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.

In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.

Creating a Fork

Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your repo or j

You can’t perform that action at this time.