Skip to content

Instantly share code, notes, and snippets.

@fffx
fffx / gist:07b2f4f07af0b450be6b49362ac20397
Last active June 10, 2021 04:15
WSL update proxychains config, WSL window host ip
# /etc/proxychains4.conf.example

[ProxyList]
# add proxy here ...
# meanwile
# defaults set to "tor"
socks5 WSL_HOST_IP 1080
@fffx
fffx / redis_cheatsheet.bash
Created January 17, 2019 06:05 — forked from LeCoupa/redis_cheatsheet.bash
Redis Cheatsheet - Basic Commands You Must Know --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
# Redis Cheatsheet
# All the commands you need to know
redis-server /path/redis.conf # start redis with the related configuration file
redis-cli # opens a redis prompt
# Strings.
This file has been truncated, but you can view the full file.
ii deepin-wine-helper:i386 1.1deepin12 i386 Deepin Wine Hepler
ii deepin-wine-plugin 1.0deepin2 amd64 Deepin Wine plugin
ii deepin-wine-plugin-virtual 1.0deepin2 all Deepin Wine plugin virtual package
ii deepin-wine-uninstaller:i386 0.1deepin2 i386 Deepin Wine Uninstaller Tool
ii deepin.com.baidu.pan:i386 5.5.4deepin8 i386 Baidu net disk client on Deepin Wine
rc deepin.com.qq.im:i386 8.9.19983deepin23 i386 Tencent QQ Client on Deepin Wine
ii deepin.com.qq.im.light:i386 7.9.14308deepin8 i386 Tencent QQ Client on Deepin Wine
ii deepin.com.qq.office:i386
@fffx
fffx / gist:0beee2d5dc8142bff1670b15dedaccc9
Created October 25, 2018 03:44 — forked from ryanlecompte/gist:1283413
Providing an ActiveRecord-like before_filter capability to arbitrary Ruby classes
# First the end result of what we want:
class Foo
before_hook :whoa
before_hook :amazing
def test
puts "This is kinda cool!"
end
@fffx
fffx / gist:27eb438713aad0f8f0e3aeec877c2d09
Created August 26, 2018 05:00 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@fffx
fffx / README.md
Created July 8, 2018 12:35 — forked from yang-wei/README.md
ES6 destructing (and rest parameter)

We will first discussed how destructing and rest parameters can be used in ES6 - in arrays and objects. Then we will look at a few examples and also discuss some quiz.

arrays

var array = [1, 2, 3, 4];
var nestedArray = [1, 2, 3, 4, [7, 8, 9]];

var [a, b, c, d] = array;
console.log(a, b, c, d)
#!/usr/bin/env bash
#!/bin/bash -xv # puts this line in the beginning for debug
# This hook, auto checkout related repo to corresponding branch
# Current branch
branch=$(git symbolic-ref --short HEAD)
# Dependended repos
repos=(dependened_repo_a dependened_repo_b)
@fffx
fffx / nginxproxy.md
Created January 7, 2018 02:19 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@fffx
fffx / weekend_day_count.rb
Last active February 1, 2018 01:56
a optimized way count weekend days
#!/usr/bin/env ruby
require 'date'
require 'benchmark'
def weekend_count(start_date, end_date)
size = (end_date - start_date).to_i
count = 0
if start_date.wday != 0
size -= (7 - start_date.wday).to_i
count += 1
@fffx
fffx / pryrc
Created November 25, 2017 06:21
Add rvm gem_home to load_path on rails console
# Inspired by https://gist.github.com/skojin/794915
if defined?(::Bundler)
current_gemset = ENV['GEM_HOME']
$LOAD_PATH.concat(Dir.glob("#{current_gemset}/gems/*/lib")) if current_gemset
end