Skip to content

Instantly share code, notes, and snippets.

View DuckSoft's full-sized avatar
🌟
Ex nihilo ad astra

DuckSoft DuckSoft

🌟
Ex nihilo ad astra
View GitHub Profile
@DuckSoft
DuckSoft / go-proposal.md
Last active July 3, 2017 07:36
proposal: introducing a new raw string literal

Background

It came to me when I was writing something like this:

package main
import "fmt"

func main() {
    fmt.Println(`----------------
Demo Program
----------------
@DuckSoft
DuckSoft / shit.sh
Created December 16, 2017 09:02
fuck
echo "fucking bitch"
@DuckSoft
DuckSoft / phvck_you.sh
Created December 16, 2017 09:04
phvck_you
echo "Fuck you!"
@DuckSoft
DuckSoft / bugku-web-baopo.py
Created May 26, 2018 07:21
BugKuCTF Web Baopo
import requests
import threadpool
pool = threadpool.ThreadPool(32)
flag = False
def worker(i):
global flag
if flag:
@DuckSoft
DuckSoft / flask-ssl.md
Created June 2, 2018 18:55
Flask 使用自定义SSL证书
    # from myapp import app
    app.run("0.0.0.0", port=443, ssl_context=("xxx.cer", "xxx.key"))
// 垃圾思路
#include <vector>
#include <iostream>
#include <sstream>
using namespace std;
int main() {
stringstream ss;
vector<string> fucker;
// 精度取舍
#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
inline double func(int a, int n) {
return pow(a, pow(2, 1-n));
}

Keybase proof

I hereby claim:

  • I am ducksoft on github.
  • I am ducksoft (https://keybase.io/ducksoft) on keybase.
  • I have a public key ASDKXBzN0NLcOX3-P-G7UHs1QCbPBD_JkLtRrjJw72ECEgo

To claim this, I am signing this object:

@DuckSoft
DuckSoft / kotlin-md5-snipplet.md
Created October 5, 2018 22:10
Kotlin MD5 Snipplet

Code

@Suppress("SpellCheckingInspection")
fun ByteArray.toHexStringLCase(): String = "0123456789abcdef".let { hexChars ->
    StringBuilder(this.size * 2).also { s ->
        this.forEach { byte ->
            byte.toInt().also { int ->
                s.append(hexChars[int shr 4 and 0x0f])
                s.append(hexChars[int and 0x0f])
 }
@DuckSoft
DuckSoft / kotlin-des-base64-snipplet.md
Last active October 5, 2018 22:44
Kotlin DES+Base64 Snipplet

Code

import java.util.*
import javax.crypto.Cipher
import javax.crypto.SecretKey

fun ByteArray.encryptDES(key: SecretKey): ByteArray? = try {
    Cipher.getInstance("DES")?.run {
        init(Cipher.ENCRYPT_MODE, key)
        doFinal(this@encryptDES)