Skip to content

Instantly share code, notes, and snippets.

@iilxy
iilxy / rawudp.go
Created May 27, 2020 16:21 — forked from eycorsican/rawudp.go
constructing ip/udp packets in go
package main
import (
"bufio"
"bytes"
"encoding/binary"
"flag"
"fmt"
"net"
"os"
@iilxy
iilxy / spatialite_example.go
Created June 23, 2018 06:32 — forked from ptrv/spatialite_example.go
SpatiaLite example in Go
package main
import (
"database/sql"
"github.com/mattn/go-sqlite3"
"log"
"os"
)
func runQuery(db *sql.DB, query string) {
@iilxy
iilxy / openbrowser.go
Created June 15, 2018 12:53 — forked from threeaccents/openbrowser.go
open chrome browser with golang function
// openBrowser tries to open the URL in a browser,
// and returns whether it succeed in doing so.
func openBrowser(url string) bool {
var args []string
switch runtime.GOOS {
case "darwin":
args = []string{"open"}
case "windows":
args = []string{"cmd", "/c", "start"}
default:
@iilxy
iilxy / tornado-nginx-example.conf
Created February 23, 2018 08:56 — forked from didip/tornado-nginx-example.conf
Nginx config example for Tornado
worker_processes 2;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
use epoll;
}
@iilxy
iilxy / 1_pdf.py
Created February 23, 2018 07:17 — forked from philfreo/1_pdf.py
Three ways to make a PDF from HTML in Python (preferred is weasyprint or phantomjs)
def render_pdf_weasyprint(html):
from weasyprint import HTML
pdf = HTML(string=html.encode('utf-8'))
return pdf.write_pdf()
def render_pdf_xhtml2pdf(html):
"""mimerender helper to render a PDF from HTML using xhtml2pdf.
Usage: http://philfreo.com/blog/render-a-pdf-from-html-using-xhtml2pdf-and-mimerender-in-flask/
"""
@iilxy
iilxy / getimage.groovy
Created June 5, 2017 07:33 — forked from tango238/getimage.groovy
Download image files from Chrome's Developer tools "Save All as HAR".
import groovy.json.*
def slurper = new JsonSlurper()
def text = new File('hoge.com.har').text
def root = slurper.parseText(text)
def getImage(address){
def command = 'wget ' + address
def proc = command.execute()
proc.waitFor()
@iilxy
iilxy / v2ex_sign.py
Created February 21, 2017 01:32 — forked from za2016/v2ex_sign.py
v2ex自动签到小脚本
#-*- coding=utf-8 -*-
import requests
import re
import sys
reload(sys)
sys.setdefaultencoding('utf8')
signin='http://v2ex.com/signin'
home='http://v2ex.com'
import time
import sys
import os
import ctypes
ES_CONTINUOUS = 0x80000000
ES_AWAYMODE_REQUIRED = 0x00000040
ES_SYSTEM_REQUIRED = 0x00000001
ES_DISPLAY_REQUIRED = 0x00000002
@iilxy
iilxy / update_clipboard_picture_to_web.py
Created January 2, 2017 14:07
update_clipboard_picture_to_web.py
#coding=utf-8
import requests
import json
import mimetypes
from PIL import ImageGrab
import datetime
def upload(files):
APIKey = "YOUR API KEY"
format = "json"
@iilxy
iilxy / upload.py
Created January 2, 2017 14:05 — forked from FormatFish/upload.py
针对sm.ms的图床
#coding=utf-8
import requests
import json
import mimetypes
from PIL import ImageGrab
import datetime
def upload(files):
APIKey = "YOUR API KEY"
format = "json"