Skip to content

Instantly share code, notes, and snippets.

🌚
                                                                               🙃

ifduyue

🌚
                                                                               🙃
  • 中国贵州
Block or report user

Report or block ifduyue

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ifduyue
ifduyue / perl-one-liners.bash
Last active Sep 21, 2019
My Perl one liner collections
View perl-one-liners.bash
# Check if FILES contain lines ending with whitespaces
perl -Mopen=IO,:raw -ne 'print "$ARGV $.\n" if /\s\R/; $.=0 if eof;' FILES
# shuffle lines
perl -MList::Util=shuffle -e 'print shuffle <>'
@ifduyue
ifduyue / perl.sh
Last active Jul 20, 2019
Perl check if lines contain trailing spaces
View perl.sh
perl -Mopen=IO,:raw -ne 'chop; print "$ARGV\@$.: $_\n" if /\s$/'
@ifduyue
ifduyue / alpine.txt
Last active May 14, 2019
golang alpine docker image higher rss memory consumption than stretch docker image
View alpine.txt
# for i in 3.5 3.6 3.7 3.8 3.9;do docker run -ti --rm -v ~/main.go:/go/main.go golang:alpine$i /bin/sh -c "go build main.go; time -v ./main > /dev/null; go version";done;
Command being timed: "./main"
User time (seconds): 0.00
System time (seconds): 0.00
Percent of CPU this job got: 50%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0m 0.00s
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
View xx.php
<?php
$a = array('<foo>',"'bar'",'"baz"','&blong&', "\xc3\xa9", "中文");
echo "Normal: ", json_encode($a), "\n";
echo "Tags: ", json_encode($a, JSON_HEX_TAG), "\n";
echo "Apos: ", json_encode($a, JSON_HEX_APOS), "\n";
echo "Quot: ", json_encode($a, JSON_HEX_QUOT), "\n";
echo "Amp: ", json_encode($a, JSON_HEX_AMP), "\n";
echo "Unicode: ", json_encode($a, JSON_UNESCAPED_UNICODE), "\n";
echo "All: ", json_encode($a, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE), "\n\n";
View activatorconfig.txt
# This are the proxy settings we use for activator
-Dhttp.proxyHost=127.0.0.1
-Dhttp.proxyPort=1087
-Dhttp.nonProxyHosts="localhost|127.0.0.1"
-Dhttps.proxyHost=127.0.0.1
-Dhttps.proxyPort=1087
-Dhttps.nonProxyHosts="localhost|127.0.0.1"
# These are commented out, but if you need to use authentication for your proxy, please fill these out.
#-Dhttp.proxyUser=PUT YOUR PROXY USER HERE
#-Dhttp.proxyPassword=PUT YOUR PROXY PASSWORD HERE
@ifduyue
ifduyue / bench.txt
Last active Jun 14, 2018
mvps.net VPS BASIC €7.00 EUR / month, CPU 2 cores, RAM 4GB, disk 50GB SSD benchmark
View bench.txt
# wget -qO- bench.sh | bash
----------------------------------------------------------------------
CPU model : Common KVM processor
Number of cores : 2
CPU frequency : 2199.998 MHz
Total size of Disk : 48.0 GB (2.0 GB Used)
Total amount of Mem : 3789 MB (173 MB Used)
Total amount of Swap : 2047 MB (0 MB Used)
System uptime : 0 days, 0 hour 53 min
Load average : 1.48, 1.68, 1.36
@ifduyue
ifduyue / -.md
Last active Sep 13, 2019
Resolve pycurl: libcurl link-time ssl backend (nss) is different from compile-time ssl backend (openssl)
View -.md
# yum
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

   pycurl: libcurl link-time ssl backend (nss) is different from compile-time ssl backend (openssl)

Please install a package which provides this module, or
verify that the module is installed correctly.
View -
t timeline $(t whoami | perl -ne 'print $1 if /^Screen name\s+@(.+)/') --csv --number
99999 | perl -lne 'print $1 if /^(\d+),/' | xargs -L99 t delete status -f
t timeline @yourid --csv --number 99999 | egrep -o '^[0-9]+' | xargs -L99 t delete status -f
@ifduyue
ifduyue / build.sh
Last active Apr 27, 2019
firefox-no-proxy-for-china
View build.sh
#!/bin/bash
awk '!/^($|#)/' no-proxy.txt | tee no-proxy-generated.txt
View rename
#!/usr/bin/env perl
use strict;
use warnings;
use Getopt::Long 2.24, qw( :config bundling no_ignore_case no_auto_abbrev );
my ( $N, $EXT, @EXT, @USE, $DECODE, $ENCODE );
sub compile { eval shift } # defined early to control the lexical environment
my $msglevel = 0;
You can’t perform that action at this time.