Skip to content

Instantly share code, notes, and snippets.

kehlarn teichopsia

Block or report user

Report or block teichopsia

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@teichopsia
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(); }
bar();
$ 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
teichopsia / blender-keymap-dump.py
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.
View blender-keymap-dump.py
#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
wm=bpy.context.window_manager
kmlut={
@teichopsia
teichopsia / 1.google-analytics-proxy-nginx.conf
Created Jul 28, 2018 — forked from paivaric/1.google-analytics-proxy-nginx.conf
Google Analytics Proxy using Nginx to bypass Adblock and other blockers
View 1.google-analytics-proxy-nginx.conf
server {
listen 80;
server_name your.domain.com;
location = /analytics.js {
# you have to compile nginx with http://nginx.org/en/docs/http/ngx_http_sub_module.html (this is not default)
# and http://nginx.org/en/docs/http/ngx_http_proxy_module.html (it's a default module)
proxy_set_header Accept-Encoding "";
@teichopsia
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 SET attrib=+ATTRIB_HIDE
SET attrib=-ATTRIB_HIDE
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 example.com
// @author kehlarn
// @homepageURL https://teichopsia.github.io/
// @version 1
// @match https://www.netflix.com/browse
// @grant none
// ==/UserScript==
You can’t perform that action at this time.