Skip to content

Instantly share code, notes, and snippets.

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

TxThinking txthinking

💭
I may be slow to respond.
View GitHub Profile
@txthinking
txthinking / cla.txt
Created February 14, 2023 08:13
TxThinking Individual Contributor License Agreement
TxThinking Individual Contributor License Agreement
In order to clarify the intellectual property license granted with Contributions from any person or entity, Cloud <cloud@txthinking.com> and TxThinking, Inc. ("TxThinking") must have a Contributor License Agreement ("CLA") on file that has been signed by each Contributor, indicating agreement to the license terms below. This license is for your protection as a Contributor as well as the protection of TxThinking; it does not change your rights to use your own Contributions for any other purpose.
You accept and agree to the following terms and conditions for Your present and future Contributions submitted to TxThinking. Except for the license granted herein to TxThinking and recipients of software distributed by TxThinking, You reserve all right, title, and interest in and to Your Contributions.
1. Definitions.
"You" (or "Your") shall mean the copyright owner or legal entity authorized by the copyright owner that is making this Agreement with TxThinking. F
package main
import (
"context"
"crypto/tls"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
@txthinking
txthinking / pastebin.js
Last active July 11, 2023 04:28
Pastebin: with times limit, expiration for Brook GUI
//
// There are many pastebin service: https://soso.ooo/search.html?q=pastebin
// This too, and with times limit, expiration, and browser User-Agent limit, allow only Go and Dart UA for Brook GUI
//
// This script will create a webserver on http://127.0.0.1:2023
// You can modify the listen address at the bottom of this file.
//
// Because the data is stored in localStorage, there is a size limit of 10M, and a clearing operation will be performed automatically after exceeding.
// So, you can fork and modify me.
//
@txthinking
txthinking / sitemap
Last active March 7, 2022 03:24
sitemap
#!/bin/bash
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" > sitemap.xml
echo "<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">" >> sitemap.xml
for l in `ls -l --time-style '+%Y-%m-%dT%H:%M:%SZ' ./articles | grep -P '\.article' | awk '{print $6";"$7}'`
do
t=`echo $l | cut -d\; -f1`
f=`echo $l | cut -d\; -f2`
echo "<url>" >> sitemap.xml
echo "<loc>https://talks.txthinking.com/articles/$f</loc>" >> sitemap.xml
@txthinking
txthinking / sort.js
Created October 7, 2021 03:04
Minimal code sort 😨
var unbelievable_sort = (a) => {
for (var i = 0; i < a.length; i++) {
for (var j = 0; j < a.length; j++) {
if (a[i] < a[j]) {
var x = a[i];
a[i] = a[j];
a[j] = x;
}
}
}
@txthinking
txthinking / mdtoc
Last active January 24, 2022 05:03
markdown toc fork of gh-md-toc
#!/usr/bin/env bash
#
# Steps:
#
# 1. Download corresponding html file for some README.md:
# curl -s $1
#
# 2. Discard rows where no substring 'user-content-' (github's markup):
# awk '/user-content-/ { ...
@txthinking
txthinking / rawudp.go
Created May 26, 2018 02:57 — forked from chrisnc/rawudp.go
constructing ip/udp packets in go
package main
import (
"bufio"
"bytes"
"encoding/binary"
"flag"
"fmt"
"net"
"os"
@txthinking
txthinking / dns_query_a.py
Last active March 31, 2019 12:51
DNS query with Brook client
#!/usr/bin/env python
#
# Send DNS Query A record of domain: txthinking.com to 119.29.29.29:53
#
from socket import *
from binascii import *
import struct
s = socket(AF_INET,SOCK_DGRAM)
/**
* @file jQuery.js
* @brief nothing
* @author cloud@txthinking.com
* @version 0.0.1
* @date 2013-06-21
*/
(function() {
var jQuery = function() {
if (this == window) {
@txthinking
txthinking / isIE.js
Created September 6, 2012 13:01
is ie browser
if(!-[1,])
// [1,]: array
// array to string ie: 1, not ie: 1
// -: string to integer ie:NaN(1,) not ie: 1(1)
// !NaN: true !1: false
alert("Hi! You are using a 2B browser now!");