Skip to content

Instantly share code, notes, and snippets.

@cloudwu
cloudwu / sortnumber.c
Created August 1, 2023 05:38
sort telephone number
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <stdio.h>
#define N (100000063/64)
struct bitset {
uint64_t bits[N];
@syhily
syhily / download_talebook.sh
Last active January 9, 2023 08:01
Download all the books from a talebook website. The https://curl.se/ and https://stedolan.github.io/jq/ are required for using this script.
#!/usr/bin/env bash
# Download metadata, modify these as your needs.
## The directory to save the downloaded files.
download_directory="/volume1/Download/EPUB"
## The website you want to visit.
calibre_site="http://soulseeker.myds.me:25788"
## The formats you want to download. We only download the first present format.
## All the formats should be upper case.
allow_formats=( EPUB MOBI AZW3 )
@joaquinicolas
joaquinicolas / gist:b7d0a0869485bca5156d0d4be87820f4
Created December 15, 2021 02:59
Setup flutter environment in arch linux
pacman -S --needed git base-devel
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si
yay -S flutter
java -version
sudo pacman -S jre8-openjdk
@UserExistsError
UserExistsError / winpty.go
Created September 5, 2020 18:14
Windows Pseudo Console (ConPTY) in Golang
package main
// Windows pty example
// https://devblogs.microsoft.com/commandline/windows-command-line-introducing-the-windows-pseudo-console-conpty/
import (
"io"
"os"
"fmt"
"log"
@lilydjwg
lilydjwg / gh-check
Last active March 18, 2024 04:43
gh-check: speed test to known GitHub IPs
#!/usr/bin/python3
import asyncio
import time
import socket
import argparse
import aiohttp
class MyConnector(aiohttp.TCPConnector):
@Mattemagikern
Mattemagikern / Certificates.go
Created May 9, 2019 08:31
Create x509 certificate chain using Golang. Root CA, Designated CA, server CA
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"crypto/x509/pkix"
"encoding/pem"
"fmt"
"math/big"
@rf5860
rf5860 / perlmonksReadabilityEnhancements.user.js
Last active October 19, 2021 03:53
[perlmonks.org Readability Enhancements] Make posts & code easier to read on perlmonks.org #UserScript
// ==UserScript==
// @name perlmonks.org Readability Enhancements
// @description Readability Enhancements for perlmonks.org
// @author rjf89
// @include http://perlmonks.org/*
// @include https://perlmonks.org/*
// @include http://*.perlmonks.org/*
// @include https://*.perlmonks.org/*
// @include http://www.perlmonks.org/*
// @include https://www.perlmonks.org/*
@lizrice
lizrice / Vagrantfile
Last active February 3, 2023 02:21
Vagrant file for setting up a single-node Kubernetes cluster that I can access from my desktop. Read more: https://medium.com/@lizrice/kubernetes-in-vagrant-with-kubeadm-21979ded6c63
# -*- mode: ruby -*-
# vi: set ft=ruby :
# This script to install Kubernetes will get executed after we have provisioned the box
$script = <<-SCRIPT
# Install kubernetes
apt-get update && apt-get install -y apt-transport-https
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
@jpswade
jpswade / devops_best_practices.md
Last active May 3, 2024 11:49
Devops Best Practices Checklist

Find the original here article here: Devops Best Practices

DevOps started out as "Agile Systems Administration". In 2008, at the Agile Conference in Toronto, Andrew Shafer posted an offer to moderate an ad hoc "Birds of a Feather" meeting to discuss the topic of "Agile Infrastructure". Only one person showed up to discuss the topic: Patrick Debois. Their discussions and sharing of ideas with others advanced the concept of "agile systems administration". Debois and Shafer formed an Agile Systems Administrator group on Google, with limited success. Patrick Debois did a presentation called "Infrastructure and Operations" addressing