Skip to content

Instantly share code, notes, and snippets.

View thinkhy's full-sized avatar
🐕
On vacation

thinkhy thinkhy

🐕
On vacation
View GitHub Profile
@thinkhy
thinkhy / sendmail.mc
Created April 11, 2014 16:25
sendmail configuration file
divert(-1)dnl
dnl #
dnl # This is the sendmail macro config file for m4. If you make changes to
dnl # /etc/mail/sendmail.mc, you will need to regenerate the
dnl # /etc/mail/sendmail.cf file by confirming that the sendmail-cf package is
dnl # installed and then performing a
dnl #
dnl # /etc/mail/make
dnl #
include(`/usr/share/sendmail-cf/m4/cf.m4')dnl
@thinkhy
thinkhy / smtp.pl
Last active August 29, 2015 13:59
Test SMPT server
use strict;
use warnings;
use Net::SMTP;
my $smtpserver = 'mail.server.com';
my $smtpport = 25;
my $smtpuser = 'test';
my $smtppassword = 'test';

Most active GitHub users (git.io/top)

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Sun, 03 Mar 2013 21:51:11 GMT till Mon, 03 Mar 2014 21:51:11 GMT.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

githubUsers
 .filter((user) -> user.followers > 246)
@thinkhy
thinkhy / gist:9188745
Created February 24, 2014 13:49
Earth's rotation from dayside and nightside
figure
load('topo.mat','topo','topomap1');
[x,y,z] = sphere(50);
cla reset
axis square off
props.AmbientStrength = 0.1;
props.DiffuseStrength = 1;
props.SpecularColorReflectance = .5;
props.SpecularExponent = 20;
props.SpecularStrength = 1;
@thinkhy
thinkhy / file.rb
Created December 8, 2013 05:40
从 Android 创建的 Gist
#多米音乐#♬分享范宗沛的专辑《望 不忘春风》http://duomi.com/album/2399864?uid=357076297&version=DM5.2.6.00_A1.6&source=
@thinkhy
thinkhy / ch7_exam.pl
Last active December 10, 2015 01:48
Exercise for Chapter 7 of "Intermediate Perl"
#########################################################################
# Brief: Exercise for Chapter 7 of "Intermediate Perl"
# File: ch7_exam.pl
# Creator: thinkhy
# Date: 12/23/2012
#########################################################################
use File::Find;
use Time::Local;
use File::Spec::Functions qw(canonpath no_upwards);
@thinkhy
thinkhy / transcript.pl
Created November 17, 2012 08:58
Description: Convert transcript from Youtube format to SRT format
#!/usr/local/bin/perl
################################################################################
# File: transcript.pl
# Desscription: convert transcript from Youtube format to SRT format
#
# Usage: transcript.pl old_file new_file
# Creator: thinkhy
# Date: 2012.11.17
# ChangeLog: 1 Initial version. [thinkhy 2012.11.17]
#
@thinkhy
thinkhy / unpack.pl
Created October 28, 2012 01:27
using unpack to deal with fix-width data
my $format = 'A2 @4 A10 @16 A6 @24 A*';
my $string = <<'COLUMMNAR';
ID First Name Middle Last Name
1 brian d foy
2 Joshua McAdams
3 Joseph N Hall
COLUMMNAR
open my ($fh), '<', \$string;
@thinkhy
thinkhy / track_connection.pl
Created August 9, 2012 15:16
A easy way to track connection status
use Net::Telnet;
use strict;
my $hostname = 'xxx';
my $username = "xx";
my $password = "xx";
my @conns_old = grep { /:23\s+/ } qx(netstat -na);
my %existed = map { $_ => 1 } @conns_old;
@thinkhy
thinkhy / crawl_links.pl
Created June 23, 2012 04:31
Extract links from webpage.