Skip to content

Instantly share code, notes, and snippets.

View digizeph's full-sized avatar
🌟

Mingwei Zhang digizeph

🌟
View GitHub Profile
@digizeph
digizeph / gist:5513982
Last active December 16, 2015 23:29
This is a perl script that helps you retrive your public IP address. This is useful if your terminal is located in a private network with NAT to access internet.
#!/usr/bin/perl
use LWP::Simple;
my @lines=split("\n",get("http://myip.dk"));
foreach my $line (@lines)
{
if($line =~ />([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)</)
{
print "found : $1\nin line $line\n";
@digizeph
digizeph / gist:5513994
Created May 3, 2013 20:50
Haskell代码,用来下载时光网(mtime.com)安妮海瑟薇的相册。工作不稳定,有可能被时光网打飞,如果下载不动,请重新运行,不会重复下载!【添加功能,能够通过命令行参数方式输入需要下载的地址首页】
import System.Directory
import System.IO
import System.Environment
import Network.HTTP
import Network.URI (parseURI)
import Text.Regex.Posix
import Data.Maybe
import Control.Monad -- when
import qualified Data.ByteString as B
@digizeph
digizeph / fetchRPKI.sh
Last active December 17, 2015 02:29
A simple script to fetch all RPKI RIR repositories to you local computer. Have no idea how to read those data yet.
#!/bin/bash
# Fetch all RPKI repos from RIR
echo "Fetching AFRINIC ..."
rsync -r -a -v --delete rsync://rpki.afrinic.net/repository afrinic/repository
rsync -r -a -v --delete rsync://rpki.afrinic.net/member_repository afrinic/member_repository
echo "Fetching APNIC ..."
rsync -r -a -v --delete rsync://rpki.apnic.net/repository apnic/repository
@digizeph
digizeph / locateDomain.sh
Created September 11, 2013 08:43
one-line command to extract coordinate from the given domain name. geopy python packet is needed.
for var in "$@"; do python -c "from geopy import geocoders as gc; from sys import ar gv;_,lat = gc.GoogleV3().geocode(' '.join(argv[1:])); print lat[0],lat[1]" $(whois $ (nslookup $var|grep Address|sed -n 2p| cut -f 2|sed 's/#.*//') | grep 'City\|State' | awk '{print $2}' | xargs -n 2) ; done
@digizeph
digizeph / testDownload.sh
Created September 13, 2013 04:28
Using wget to test download speed
#!/bin/bash
wget --output-document=/dev/null http://speedtest.wdc01.softlayer.com/downloads/test500.zip
@digizeph
digizeph / map.sh
Created September 14, 2013 00:20
Mac OS X: Open up Google Maps to show the place you type in as arguments. For example: ./map.sh University of Oregon, Eugene OR, and it will pop up a Chrome browser, open Google Maps, gives you the map of University of Oregon.
#!/bin/bash
open http://maps.google.com/?ll=$(python -c "from geopy import geocoders as gc; from sys import argv;_,lat = gc.GoogleV3().geocode(' '.join(argv[1:])); print '%s,%s'%(lat[0],lat[1])" $@)
@digizeph
digizeph / ProgramCaller.java
Created February 5, 2014 08:17
Class to call external programs in Java and return the output String.
package util;
import java.io.BufferedReader;
import java.io.InputStreamReader;
/**
* Created by dan on 2/4/14.
*/
public class ProgramCaller {
@digizeph
digizeph / bgp_inspector.css
Created September 23, 2014 05:52
bgp_inspector css
html, body, #map-canvas {
height: 100%;
margin: 0px;
padding: 0px
}
.nicebox {
position: absolute;
text-align: left;
font-family: "Roboto", "Arial", sans-serif;
@digizeph
digizeph / config.plist
Created October 12, 2014 18:21
A success hackintosh clover configuration file for Dell Alienware X51
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Graphics</key>
<dict>
<key>InjectEDID</key>
<true/>
<key>Inject</key>
<dict>
==Phrack Inc.==
Volume One, Issue 7, Phile 3 of 10
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The following was written shortly after my arrest...
\/\The Conscience of a Hacker/\/
by