Skip to content

Instantly share code, notes, and snippets.

@xmeng1
xmeng1 / wsl2-network.ps1
Created July 14, 2019 06:50
WSL2 Port forwarding port to linux
$remoteport = bash.exe -c "ifconfig eth0 | grep 'inet '"
$found = $remoteport -match '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}';
if( $found ){
$remoteport = $matches[0];
} else{
echo "The Script Exited, the ip address of WSL 2 cannot be found";
exit;
}
@RisingInIris2017
RisingInIris2017 / Proxifier_SSR-V2rayN.md
Last active April 4, 2024 14:39
Proxifier+SSR/V2rayN代理软件教程

写在前面

现在很多人都有魔法上网手段,常用的魔法上网工具有 SSR 和 V2rayN 两种。

这两种工具已经相当强大,能够使我们坐地日行八万里,访问我们喜爱的网站。

但是这两种工具也有美中不足之处:似乎它们只支持浏览器访问网页时走代理,

而对于除了浏览器以外的应用程序,就并没有通过代理,导致一些被墙的软件不能很好地使用。

@shinebayar-g
shinebayar-g / Fix redis server startup warnings, redis tuning performance on Ubuntu 16.04.md
Last active July 13, 2023 01:17
Fix redis server startup warnings, redis tuning performance on Ubuntu 16.04
  • Maximum Open Files
You requested maxclients of 10000 requiring at least 10032 max file descriptors.
Server can't set maximum open files to 10032 because of OS error: Operation not permitted.
Current maximum open files is 4096. maxclients has been reduced to 4064 to compensate for maxclients has been reduced to 4064 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'.
@jlis
jlis / index.js
Created May 18, 2018 08:49
AWS Lambda function to save events from SQS into DynamoDB
var AWS = require('aws-sdk');
var sqs = new AWS.SQS({
region: process.env.AWS_REGION
});
var dynamodb = new AWS.DynamoDB();
var REPEAT_THRESHOLD = process.env.REPEAT_THRESHOLD || 20000;
function receiveSQSMessages(callback) {
var params = {
QueueUrl: process.env.TASK_QUEUE_URL,
@HighMacGuy
HighMacGuy / first_run.ini
Last active August 18, 2022 16:52 — forked from andyspicer/install.sh
OpenVPN Access Server Letsencrypt
# OpenVPN Let's Encrypt first run config file
#https://loige.co/using-lets-encrypt-and-certbot-to-automate-the-creation-of-certificates-for-openvpn/
cert-name=
authenticator = standalone
standalone-supported-challenges = tls-sni-01
non-interactive = True
rsa-key-size = 4096
email = "user@server.com"
domains = "vpn.server.com"
@kilink
kilink / OkHttpCompletableFuture.kt
Created February 11, 2017 07:26
OkHttp Java 8 CompletableFuture extension method
import okhttp3.Call
import okhttp3.Callback
import okhttp3.Response
import java.io.IOException
import java.util.concurrent.CompletableFuture
fun Call.executeAsync(): CompletableFuture<Response> {
val future = CompletableFuture<Response>()
enqueue(object : Callback {
override fun onResponse(call: Call, response: Response) {
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Purchasing;
// Deriving the Purchaser class from IStoreListener enables it to receive messages from Unity Purchasing.
using UnityEngine.Purchasing.Security;
public class Purchaser : MonoBehaviour, IStoreListener
@abhijeetchopra
abhijeetchopra / 0-README.md
Last active July 15, 2024 07:25
Creating automatic scheduled backup copies of your Google Sheets using Google Apps Script

How to "Schedule Automatic Backups" of your Google Sheets

This tutorial demonstrates how to use Google Apps Script to:

  • Create copies of the Google Sheet in the desired destination folder automatically at set intervals.

  • Append the time stamp with each backup file's name.

  • Adjust time trigger for backing up every day/hour/minute.

@rponte
rponte / get-latest-tag-on-git.sh
Last active July 4, 2024 10:55
Getting latest tag on git repository
# The command finds the most recent tag that is reachable from a commit.
# If the tag points to the commit, then only the tag is shown.
# Otherwise, it suffixes the tag name with the number of additional commits on top of the tagged object
# and the abbreviated object name of the most recent commit.
git describe
# With --abbrev set to 0, the command can be used to find the closest tagname without any suffix:
git describe --abbrev=0
# other examples
@kythanh
kythanh / How to delete all Archive binaries generated by XCode
Created August 7, 2014 07:03
How to delete all Archive binaries generated by XCode
1. Open Terminal, then goto this folder: cd ~/Library/Developer/Xcode/Archives
2. Perform delete all folders and files: rm -rf *
You may need root permission to perform delete.