Skip to content

Instantly share code, notes, and snippets.

View digizeph's full-sized avatar
🌟

Mingwei Zhang digizeph

🌟
View GitHub Profile
@digizeph
digizeph / unix-ts-to-str.el
Created May 6, 2020 17:35
Emacs lisp function to convert unix timestamp to human-readable string in RFC3339 format.
(defun unix-ts-to-str (&optional time zone)
"Convert unix timestamp integer to human-readable string in RFC3339 format."
(interactive "nTimestamp: ")
(setq zone (or zone "UTC"))
(setq ts-str (format "%s" (or time (current-word))))
(if (numberp (read ts-str))
(progn
(setq ts-int (string-to-number ts-str))
;; send message to Message buffer
;; copy to kill-ring (clipboard)
@font-face{
font-family: 'JetBrains Mono';
src: url('https://raw.githubusercontent.com/JetBrains/JetBrainsMono/master/web/eot/JetBrainsMono-Regular.eot') format('embedded-opentype'),
url('https://raw.githubusercontent.com/JetBrains/JetBrainsMono/master/web/woff2/JetBrainsMono-Regular.woff2') format('woff2'),
url('https://raw.githubusercontent.com/JetBrains/JetBrainsMono/master/web/woff/JetBrainsMono-Regular.woff') format('woff'),
url('https://raw.githubusercontent.com/JetBrains/JetBrainsMono/master/ttf/JetBrainsMono-Regular.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
@digizeph
digizeph / test-ris-threads.sh
Created November 15, 2019 17:44
Test max number of simutaneous download of RIS bgp data before server disconnects.
filelist=(
"http://data.ris.ripe.net/rrc00/2019.11/updates.20191115.1725.gz"
"http://data.ris.ripe.net/rrc00/2019.11/updates.20191115.1720.gz"
"http://data.ris.ripe.net/rrc00/2019.11/updates.20191115.1715.gz"
"http://data.ris.ripe.net/rrc00/2019.11/updates.20191115.1710.gz"
"http://data.ris.ripe.net/rrc00/2019.11/updates.20191115.1705.gz"
"http://data.ris.ripe.net/rrc00/2019.11/updates.20191115.1700.gz"
"http://data.ris.ripe.net/rrc00/2019.11/updates.20191115.1625.gz"
"http://data.ris.ripe.net/rrc00/2019.11/updates.20191115.1620.gz"
"http://data.ris.ripe.net/rrc00/2019.11/updates.20191115.1615.gz"
@digizeph
digizeph / simple-print.py
Created November 13, 2019 22:15
print bgp update entries with some simple filters
#!/usr/bin/env python
import pybgpstream
stream = pybgpstream.BGPStream(
from_time="2017-07-07 00:00:00", until_time="2017-07-07 00:10:00 UTC",
collectors=["route-views.sg", "route-views.eqix"],
record_type="updates",
filter="peer 11666 and prefix more 210.180.0.0/16"
)
@digizeph
digizeph / Vagrantfile
Created August 16, 2019 23:45
vagrantfile for different ubuntu versions
#!/usr/bin/env ruby
Vagrant.configure("2") do |config|
#### LTS VERSIONS ####
# 18.04
config.vm.define "bionic" , primary: true do |bionic|
bionic.vm.box = "ubuntu/bionic64"
bionic.vm.box_check_update = true
@digizeph
digizeph / caida-repo.sh
Last active August 22, 2019 20:55
script to add caida ubuntu repositories
#!/usr/bin/env bash
CAIDA_REPO_URL=https://pkg.caida.org/os/ubuntu
sudo apt-get update
sudo apt-get install -y curl apt-transport-https ssl-cert ca-certificates gnupg lsb-release
# wandio repo
echo "deb https://dl.bintray.com/wand/general $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/wand.list
curl --silent "https://bintray.com/user/downloadSubjectPublicKey?username=wand" | sudo apt-key add -
@digizeph
digizeph / Vagrantfile
Created April 26, 2019 21:50
Vagrantfile for libbgpstream
# -*- mode: ruby -*-
# vi: set ft=ruby :
$setup_system = <<-SCRIPT
apt update
apt upgrade -y
apt autoremove -y
# utilitities
apt install -y screen vim git
@digizeph
digizeph / gist:e4af37810489728ed79d7622f230b278
Created August 26, 2018 18:49
Updates during 2018-04-24 BGP hijacking event against Amazon DNS
24 Apr 2018: Amazon DNS Hijacked by eNet
https://twitter.com/InternetIntel/status/988792927068610561
Table compiled with data using CAIDA's BGPStream (http://bgpstream.caida.org/)
|--------+------+-------------------+------------+---------------------+----------+-----------------+------------------+-----------------+------------------------------+-----------|
| Update | Type | Time | Project | Collector | Peer ASN | Peer IP | Prefix | Nexthop | AS path | Origin AS |
|--------+------+-------------------+------------+---------------------+----------+-----------------+------------------+-----------------+------------------------------+-----------|
| U | A | 1524567942.000000 | routeviews | route-views.chicago | 32709 | 206.223.119.134 | 205.251.192.0/24 | 206.223.119.134 | 32709 6939 10297 | 10297 |
| U | A | 1524567945.000000 | routeviews | route-views.chicago | 293 | 206.223.119.58 | 205.251.192.0
Debugger entered--Lisp error: (wrong-number-of-arguments setq 1)
(setq mu4e-sent-messages-behavior)
(closure (t) nil (setq mu4e-update-interval 60) (setq mu4e-sent-messages-behavior) (setq mu4e-use-fancy-chars nil) (require 'smtpmail nil nil) (setq message-send-mail-function 'smtpmail-send-it smtpmail-stream-type 'starttls) (setq mu4e-maildir "~/.mail") (setq mu4e-get-mail-command "mbsync -V -a") (setq mu4e-change-filenames-when-moving t) (setq mu4e-hide-index-messages t) (setq mu4e-enable-mode-line t) (setq message-kill-buffer-on-exit t) (setq mu4e-html2text-command 'mu4e-shr2text) (setq shr-color-visible-luminance-min 80) (setq mu4e-view-show-images t) (if (fboundp 'imagemagick-register-types) (progn (imagemagick-register-types))) (setq mu4e-compose-signature-auto-include nil mu4e-compose-signature "") (remove-hook 'mu4e-compose-mode-hook 'flyspell-mode) (setq mu4e-headers-include-related nil) (setq mue4e-headers-skip-duplicates t) (setq mu4e-view-show-addresses t) (setq mu4e-split-view 'horizontal) (se

Keybase proof

I hereby claim:

  • I am digizeph on github.
  • I am digizeph (https://keybase.io/digizeph) on keybase.
  • I have a public key ASBtG_nK8UTRusYNPs1UCkSXP-AHCezuu2izKWdZO2nsKAo

To claim this, I am signing this object: