Skip to content

Instantly share code, notes, and snippets.

View peterwillcn's full-sized avatar
📡
011010001000100010101010101

open source peterwillcn

📡
011010001000100010101010101
View GitHub Profile
@peterwillcn
peterwillcn / Public_Recursive_Name_Servers.md
Created January 14, 2022 14:19 — forked from mutin-sa/Top_Public_Recursive_Name_Servers.md
List of Top Public Recursive Name Servers
IPv4 Addr IPv6 Addr ASn Loc Svc Org
8.8.8.8 2001:4860:4860::8888 AS15169 Worldwide (Anycast) Google Public DNS Google
8.8.4.4 2001:4860:4860::8844 AS15169 Worldwide (Anycast) Google Public DNS Google
77.88.8.8 2a02:6b8::feed:0ff AS13238 Worldwide (Anycast) Yandex.DNS Yandex
77.88.8.1 2a02:6b8:0:1::feed:0ff AS13238 Worldwide (Anycast) Yandex.DNS Yandex
1.1.1.1 2606:4700:4700::1111 AS13335 Worldwide (Anycast) Cloudflare-DNS Cloudflare/APNIC
1.0.0.1 2606:4700:4700::1001 AS13335 Worldwide (Anycast) Cloudflare-DNS Clou
@peterwillcn
peterwillcn / how-to-upgrade-nvmw-ssd-firmware-on-linux.md
Created April 27, 2021 13:25 — forked from klingtnet/how-to-upgrade-nvmw-ssd-firmware-on-linux.md
How to upgrade [Lenovo] NVMe SSD firmware on Linux

The instructions were tested on a Lenovo X1 Carbon 5th Gen (X1C5) on Arch Linux but should be applicable to other Lenovo models and Linux distributions.

BACKUP YOUR DATA! I created a bootable Ubuntu Image like this:

$ sudo sh -c 'curl --location --silent --fail "http://releases.ubuntu.com/18.04/ubuntu-18.04.1-desktop-amd64.iso" | pv > /dev/<your-usb-drive>'
# note that pv is only there to show progress, it is perfectly fine to redirect curl to the usb drive directly.

then I booted from this drive by pressing F12 on reboot and dumped my NVMe disk to an external hard drive like this:

@peterwillcn
peterwillcn / readme.md
Created February 8, 2021 08:47 — forked from jasonkarns/readme.md
Git send-email using Gmail
  1. Configure git.
# ~/.config/git/config
[sendemail]
  confirm = auto
  smtpServer = smtp.gmail.com
  smtpServerPort = 587
  smtpEncryption = tls
  smtpUser = <gmail email address>
@peterwillcn
peterwillcn / server.ex
Created August 11, 2020 16:37 — forked from adnils/server.ex
Elixir TCP echo server
defmodule Echo.Server do
def start(port) do
tcp_options = [:binary, {:packet, 0}, {:active, false}]
{:ok, socket} = :gen_tcp.listen(port, tcp_options)
listen(socket)
end
defp listen(socket) do
{:ok, conn} = :gen_tcp.accept(socket)
spawn(fn -> recv(conn) end)
@peterwillcn
peterwillcn / change.rb
Created April 26, 2020 14:23
Example of dynamic programming in Ruby
INFINITY = 1.0/0
@changes = {}
@coins = [1, 3, 4]
def change(target_value)
return 0 if target_value == 0
return INFINITY if target_value < 0
@changes[target_value] ||= @coins.map do |coin|
change(target_value - coin) + 1

MySQL Download URL

https://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.56-linux-glibc2.5-x86_64.tar.gz

Open the terminal and follow along:

  • Uninstall any existing version of MySQL
sudo rm /var/lib/mysql/ -R
#!/bin/bash
: << '#__REM__'
指定さたライブラリをiOS用にフルオートで作成します。ダウンロード、複数のアーキテクチャのビルドも自動的に行います。デフォルトではi386、x86_64、armv7、armv7s、arm64のアーキテクチャを作成します。
Create a full-auto to iOS for the library specified. I do also builds the architecture download, more than one. Create architecture i386, x86_64, armv7, armv7s, arm64 by default.
#__REM__
TARGET_VERSION="1.3.1"
@peterwillcn
peterwillcn / htpasswd.py
Created June 12, 2019 09:56 — forked from eculver/htpasswd.py
htpasswd script in python (no need to install apache utils)
#!/usr/local/bin/python
"""Replacement for htpasswd"""
# Original author: Eli Carter
import os
import sys
import random
from optparse import OptionParser
# We need a crypt module, but Windows doesn't have one by default. Try to find
@peterwillcn
peterwillcn / cool_gpu2.sh
Created August 31, 2018 05:10 — forked from squadbox/cool_gpu2.sh
A script to control Nvidia GPU fan speed on headless (non-X) linux nodes
#!/bin/bash
# cool_gpu2.sh This script will enable or disable fixed gpu fan speed
#
# Description: A script to control GPU fan speed on headless (non-X) linux nodes
# Original Script by Axel Kohlmeyer <akohlmey@gmail.com>
# https://sites.google.com/site/akohlmey/random-hacks/nvidia-gpu-coolness
#
# Modified for newer drivers and removed old work-arounds
@peterwillcn
peterwillcn / install_elixir.md
Created July 26, 2018 13:17 — forked from rubencaro/install_elixir.md
Elixir installation guide

Elixir installation guide

Version numbers should be the ones you want. Here I do it with the last ones available at the moment of writing.

The simplest way to install elixir is using your package manager. Sadly, at the time of writing only Fedora shows the intention to keep its packages up to date. There you can simply sudo dnf install erlang elixir and you are good to go.

Anyway, if you intend to work with several versions of erlang or elixir at the same time, or you are tied to a specific version, you will need to compile it yourself. Then asdf is your best friend.