Skip to content

Instantly share code, notes, and snippets.

View levitation's full-sized avatar
💭
I may be slow to respond.

Roland Pihlakas levitation

💭
I may be slow to respond.
View GitHub Profile
@alexandrnikitin
alexandrnikitin / AhoCorasickTree.cs
Created April 14, 2017 07:44
Aho-Corasick C# implementation
using System.Collections.Generic;
using System.Linq;
namespace AhoCorasickTree
{
public class AhoCorasickTree
{
internal AhoCorasickTreeNode Root { get; set; }
public AhoCorasickTree(IEnumerable<string> keywords)
@Emory-M
Emory-M / m3u8dl.py
Last active April 8, 2023 05:38
Download m3u8 and merge ts file with python urllib2
# coding: utf8
import sys, urllib2
import socks
from sockshandler import SocksiPyHandler
from urlparse import urlparse
if len(sys.argv) < 2:
print 'Usage: python %s [url]' % sys.argv[0]
exit()
// In case of "Exceeded maximum execution time" retry after some time
// Copied files and folders will not be copied again
// Changes:
// - Don't "search" for source and target folders
// - Inline some variables (to make it run faster)
// - Avoid Logger when possible (it can make script slower)
function start() {
var source = DriveApp.getFolderById('get-source-folder-id-in-link');
@robertknight
robertknight / README.md
Last active December 31, 2022 14:39
Using Hypothesis in a JavaScript SPA with client-side routing

Update 2022-12-31:

The latest version of Hypothesis will detect client-side URL changes via the HTML 5 History API or the Navigation API and update the loaded set of annotations automatically. For this to work, the web application must follow these best practices for web apps that do client-side navigation:

  1. Update the URL when the logical route in the app changes
  2. Use the path and query string of the URL to indicate the route, not the fragment. For example https://example.com/your-app/some/page is OK, https://example.com/your-app/#!/some/page is not.
  3. The content of the page must be updated by the time Hypothesis has fetched the new annotations for the new URL. The safest way to do this is by not updating the URL until the content has been updated or is just about to be updated (eg. content has been fetched and a React/Vue/Angular re-render is queued up). In browsers that implement the new Navigation API
@tcwalther
tcwalther / delayedinterrupt.py
Last active February 2, 2024 14:59
DelayedInterrupt class - delaying the handling of process signals in Python
import signal
import logging
# class based on: http://stackoverflow.com/a/21919644/487556
class DelayedInterrupt(object):
def __init__(self, signals):
if not isinstance(signals, list) and not isinstance(signals, tuple):
signals = [signals]
self.sigs = signals
@10se1ucgo
10se1ucgo / ips+domains.txt
Last active February 23, 2016 01:44
IPs and domains blocked/re-routed by DisableWinTracking
# Blocked IPs (Firewall)
2.22.61.43
2.22.61.66
65.39.117.230
65.52.108.33
65.55.108.23
23.218.212.69
134.170.30.202
137.116.81.24
157.56.106.189
@ultratrunks
ultratrunks / DllInjector.cs
Last active January 23, 2023 20:11
Clean class in C# used for DLL injection
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace DllInjector
{
public static class DllInjector
{
@xeoncross
xeoncross / p2p-lobby.md
Last active November 17, 2015 05:54 — forked from guybrush/p2p-lobby.md

p2p-lobby

this is only proof-of-concept for now, code and readme is just a temporary braindump and may change a lot - stay tuned :D

the goal is to provide a simple way to distribute and discover p2p-app-lobbies. a lobby is basically a "room" for people (peers) that are connected to each other via p2p (webrtc). in every lobby the connected peers run a specific application (javascript-program) that utilizes the connections between the peers in some way (video/audio, reliable and

@DanDiplo
DanDiplo / JS-LINQ.js
Last active June 7, 2024 00:50
JavaScript equivalents of some common C# LINQ methods. To help me remember!
// JS array equivalents to C# LINQ methods - by Dan B.
// First: This version using older JavaScript notation for universal browser support (scroll down for ES6 version):
// Here's a simple array of "person" objects
var people = [
{ name: "John", age: 20 },
{ name: "Mary", age: 35 },
{ name: "Arthur", age: 78 },
{ name: "Mike", age: 27 },
@felthy
felthy / javascript-debug-printObject-function.js
Created April 21, 2015 06:27
Recursively dump a javascript object into a string, for when you don't have a debugger
/**
* When investigating a selenium test failure on a remote headless browser that couldn't be reproduced
* locally, I wanted to add some javascript to the site under test that would dump some state to the
* page (so it could be captured by Selenium as a screenshot when the test failed). JSON.stringify()
* didn't work because the object declared a toJSON() method, and JSON.stringify() just calls that
* method if it's present. This was a Moment object, so toJSON() returned a string but I wanted to see
* the internal state of the object instead.
*
* So, this is a rough and ready function that recursively dumps any old javascript object.
*/