Skip to content

Instantly share code, notes, and snippets.

View test_ack_lost.go
package main
import (
"github.com/google/gopacket"
"github.com/google/gopacket/layers"
"log"
"net"
"os"
"strconv"
"time"
@ls0f
ls0f / public.py
Created Feb 27, 2018 — forked from dooglus/public.py
create Bitcoin public key from private key
View public.py
#! /usr/bin/env python
class Point(object):
def __init__(self, _x, _y, _order = None): self.x, self.y, self.order = _x, _y, _order
def calc(self, top, bottom, other_x):
l = (top * inverse_mod(bottom)) % p
x3 = (l * l - self.x - other_x) % p
return Point(x3, (l * (self.x - x3) - self.y) % p)
View gist:f74f0e261c563c2e9b7fee0a61f2a811
package main
import (
"bufio"
"flag"
"fmt"
g "github.com/golang/glog"
p "github.com/ls0f/proxylib"
"golang.org/x/crypto/ssh"
"golang.org/x/crypto/ssh/terminal"
@ls0f
ls0f / install_jenkins_plugin.sh
Created Aug 26, 2016 — forked from micw/install_jenkins_plugin.sh
Script to install one or more jenkins plugins including dependencies while jenkins is offline
View install_jenkins_plugin.sh
#!/bin/bash
set -e
if [ $# -eq 0 ]; then
echo "USAGE: $0 plugin1 plugin2 ..."
exit 1
fi
plugin_dir=/var/lib/jenkins/plugins
View parse.py
#coding:utf-8
import re
class Parse(object):
def __init__(self):
self.i = -1
self.text = ""
self.js = None
View cal.py
#coding:utf-8
'''
expr ::= term { (+|-) term }*
term ::= factor { (*|/) factor }*
factor ::= ( expr )
| NUM
@ls0f
ls0f / tail.py
Created Apr 19, 2016
Python tail
View tail.py
import os
import time
import sys
class Tail(object):
def __init__(self, file_name):
self.filename = file_name
self.pos = 0
@ls0f
ls0f / proxy.go
Created Feb 26, 2016 — forked from wallrat/proxy.go
Simple GO TCP proxy
View proxy.go
package main
import (
"net"
"fmt"
"io"
"os"
)
func main() {
if len(os.Args) != 3 {
fatal("usage: netfwd local remote")
View arp.py
#coding:utf-8
import socket
import time
import os
import sys
from struct import pack
ARPOP_REQUEST = pack('!H', 0x0001)
ARPOP_REPLY = pack('!H', 0x0002)
@ls0f
ls0f / img2txt.js
Created Jan 28, 2016 — forked from justjavac/img2txt.js
img2txt:基于canvas的图片转字符画工具
View img2txt.js
var cv = document.getElementById('cv');
var c = cv.getContext('2d');
var txtDiv = document.getElementById('txt');
var fileBtn = document.getElementById("up-button");
var img = new Image();
img.src = 'a.jpg';
img.onload = init; // 图片加载完开始转换
fileBtn.onchange = getImg;
// 根据灰度生成相应字符
You can’t perform that action at this time.