Skip to content

Instantly share code, notes, and snippets.

View moriyoshi's full-sized avatar
😎
I do what to do.

Moriyoshi Koizumi moriyoshi

😎
I do what to do.
View GitHub Profile
FROM docker:dind
RUN apk add dumb-init
COPY start.sh /
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD ["/start.sh"]
@moriyoshi
moriyoshi / xpproductkey.py
Created September 8, 2019 22:04
Recover a XP product key from the registry
import math
# HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId
# offset from 28 (0x1c) to 43 (0x2b)
b = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
digits = "BCDFGHJKMPQRTVWXY2346789"
def base24(b):
v = sum((256 ** i) * c for i, c in enumerate(b))
<?php
function lz4decodeframes($in) {
if (substr($in, 0, 4) !== "\x04\x22\x4d\x18") {
throw new Exception();
}
$o = 6;
$f = ord($in[4]);
if ($f & 8) {
$o += 8;
}
Copyright (c) 2014 The Go Authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
import (
"context"
"sync/atomic"
"time"
)
type Contexts struct {
ReaderContext context.Context
ReaderCancel context.CancelFunc
WriterContext context.Context
@moriyoshi
moriyoshi / openssh-lpk.schema.ldif
Created February 4, 2018 05:08
Add SSH LDAP Public Key schema to Active Directory
dn: CN=sshPublicKey,CN=Schema,CN=Configuration,DC=testing,DC=example,DC=com
changetype: add
cn: sshPublicKey
name: sshPublicKey
lDAPDisplayName: sshPublicKey
adminDisplayName: sshPublicKey
objectClass: attributeSchema
attributeID: 1.3.6.1.4.1.24552.500.1.1.1.13
attributeSyntax: 2.5.5.10
schemaIDGUID:: +jduGq6aTj+LLL7JZhfWpw==
@moriyoshi
moriyoshi / Dockerfile
Created August 4, 2017 07:24
NFS test server
FROM alpine:3.6
RUN apk update && apk add nfs-utils openrc rsyslog
EXPOSE 2049 2050 2051 2052
VOLUME /export
RUN (\
echo '$ModLoad omstdout.so'; \
echo '$ModLoad imuxsock.so'; \
echo '$ModLoad imklog.so'; \
echo '*.* :omstdout:'; \
) > /etc/rsyslog.conf
#!/usr/bin/env python
import re
import json
from urllib.parse import urljoin
import urllib.request
TKK = [411121, 3613763667]
def Tj(a, b):
@moriyoshi
moriyoshi / exclusive_request_methods.py
Created November 12, 2016 09:01
Exclusive request method predicate for Pyramid (>= 1.7)
from pyramid.config import Configurator
from pyramid.config.predicates import RequestMethodPredicate
from pyramid.config.util import as_sorted_tuple
from pyramid.compat import string_types, text_type
from pyramid.response import Response
from pyramid.httpexceptions import HTTPMethodNotAllowed
from pyramid.view import view_config
from pyramid.viewderivers import predicated_view, INGRESS
from webtest import TestApp
@moriyoshi
moriyoshi / test.py
Last active November 9, 2016 16:08
from datetime import timedelta
import http.server
import mock
import socket
import socketserver
import ssl
import tempfile
import time
import threading
import urllib.request