Skip to content

Instantly share code, notes, and snippets.

@ficapy
ficapy / go_csv.go
Created Sep 16, 2020
Python: 60秒 Golang: 3.3秒 Rust: 2.6秒
View go_csv.go
package main
import (
"encoding/csv"
"github.com/mmcloughlin/geohash"
"github.com/suifengtec/gocoord"
"io"
"os"
)
View html_layout.js
let a = []
function _add_empty(node, raw){
// 如果多个标签合并成一个,最低保证合并的时候左右存在空格
function inner(node){
let innertext = node.innerText
if (!innertext){
return
}
let content = innertext.trim()
View full_screen.html
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Holy Grail</title>
<style>
/* some basic styles. nothing to do with flexbox */
header, footer,
nav, article, aside {
border: 1px solid black;
View download_oreilly.md
youtube-dl -v --cookies /Users/ficapy/Downloads/oreilly/cookies.txt -o "Oreilly - %(playlist)s/%(playlist_index)s - %(title)s.%(ext)s" "https://learning.oreilly.com/videos/hands-on-systems-programming/9781838822132"  --add-metadata --write-sub --convert-subs srt --sleep-interval 15 --max-sleep-interval 30 | tee $(date +%Y%m%d-%h:%M).log
View proxy.md
@ficapy
ficapy / handle_nested_dict.py
Created May 12, 2020
临时处理ElasticSearch返回的上十级嵌套
View handle_nested_dict.py
class Nested:
def __init__(self, data):
self.data = data
def __getitem__(self, item):
if self.data is None:
return Nested(None)
if isinstance(item, int) and isinstance(self.data, list):
if len(self.data) >= item:
@ficapy
ficapy / hshy_checkin.py
Last active Feb 10, 2020
练手python脚本,登陆Discuz论坛打卡签到
View hshy_checkin.py
# -*- coding: utf-8 -*-
import requests
import hashlib
import re
username = '' ###账号###
password = ''###密码###
UA = "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) \
Chrome/27.0.1453.116 Safari/537.36"
headers = {
View c5x18large.txt
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 72
On-line CPU(s) list: 0-71
Thread(s) per core: 2
Core(s) per socket: 18
Socket(s): 2
NUMA node(s): 2
Vendor ID: GenuineIntel
View closure.rs
fn apply<F>(mut f: F)
where
F: FnMut(),
{
f();
f();
}
fn main() {
let mut farewell = "goodbye".to_owned();
@ficapy
ficapy / rsa_aes.py
Last active Oct 22, 2019
pycrypto使用AES/RSA加解密
View rsa_aes.py
# !/usr/bin/env python
# -*- coding: utf-8 -*-
from Crypto.Cipher import PKCS1_v1_5
from Crypto.PublicKey import RSA
from Crypto.Hash import SHA
from Crypto import Random
from Crypto.Cipher import AES
aes_obj_enc = AES.new('This is a key123', AES.MODE_CBC, 'This is an IV456')
You can’t perform that action at this time.