Skip to content

Instantly share code, notes, and snippets.

@ifduyue
ifduyue / add-git-aliases.sh
Last active October 11, 2021 02:31
git aliases
#!/bin/bash
set -x
# common shortcuts
git config --global alias.co checkout
git config --global alias.ci commit
git config --global alias.st status
git config --global alias.br branch
git config --global alias.rb rebase
@ifduyue
ifduyue / apt install docker-engine
Created October 14, 2015 09:08
Can't install docker-engine on Ubuntu 14.04 LTS
# apt-get install -f docker-engine
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
@ifduyue
ifduyue / beanstalkd.service
Last active March 1, 2023 11:36
Install beanstalkd on CentOS 7 / CentOS 8
[Unit]
Description=Beanstalkd is a simple, fast work queue
[Service]
User=nobody
Restart=always
RestartSec=500ms
ExecStart=/usr/local/bin/beanstalkd -b /var/lib/beanstalkd
LimitNOFILE=10240
@ifduyue
ifduyue / public-dns-cn-servers-file.sh
Last active August 17, 2016 04:47
Generate dnsmasq servers-file, servers come from public-dns.info
curl -sSL http://public-dns.info/nameserver/cn.txt | perl -MList::Util=shuffle -e 'print shuffle<STDIN>' | head -n10 | xargs -L1 -I{} echo "server={}"
@ifduyue
ifduyue / install-proxychains-ng.sh
Last active November 5, 2021 06:50
Install proxychains-ng on CentOS
#!/bin/sh
# Usage:
# wget -O- https://gist.githubusercontent.com/ifduyue/dea03b4e139c5758ca114770027cf65c/raw/install-proxychains-ng.sh | sudo bash -s
set -eu
version=4.14
wget https://github.com/rofl0r/proxychains-ng/archive/v$version.tar.gz
tar xf v$version.tar.gz
from __future__ import print_function
import threading
import xxhash
import os
import time
from itertools import repeat
def work(which, input, cycle):
x = getattr(xxhash, which)(input)
for i in repeat(None, cycle):
@ifduyue
ifduyue / output.txt
Created March 17, 2017 09:42
Confused with perl5 utf8 json
"苦" 34:33510:34
"苦" 34:232:139:166:34
Wide character in say at -e line 1.
"苦" 34:33510:34
"苦" 34:232:139:166:34
"苦" 34:232:139:166:34
"苦" 34:195:168:194:139:194:166:34
"苦" 34:232:139:166:34
"苦" 34:195:168:194:139:194:166:34
#!/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;
@ifduyue
ifduyue / build.sh
Last active February 26, 2020 08:17
firefox-no-proxy-for-china
#!/bin/bash
awk '!/^($|#)/' no-proxy.txt | tee no-proxy-generated.txt
@ifduyue
ifduyue / -
Last active November 4, 2017 17:34
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