Skip to content

Instantly share code, notes, and snippets.

View xros's full-sized avatar
🎯
Focusing

Songhua Liu xros

🎯
Focusing
View GitHub Profile
@xros
xros / warp.js
Created March 30, 2024 20:09 — forked from lzjluzijie/warp.js
Cloudflare Warp 24PB key generator
# See https://halu.lu/%E6%9D%82%E8%B0%88/cloudflare-warp/
# Depolyed at https://warp.halu.lu/
// Change keys if needed
const keys = [
"9WO41D5p-6OP8xj27-36gQG75D",
"R65K12Up-aU907O2e-4nuvD581",
"06LM94EJ-1nl0V2d7-V847va5y",
]
@xros
xros / wan_ssh
Created November 7, 2023 04:17 — forked from lynus/wan_ssh
openwrt:allow wan ssh into your wrt
by default,openwrt do not allow ssh access from wan, here are two method to change that:
1.login into your wrt from a lan host.issue the following command:
iptables -F
the command "flush away" all the firewall rules,including the one that rejects ssh request from wan.
now you can try ssh from anywhere.
aware that the firewall deactivation leads to highly security risk.and after the wrt restarts ,all default firewall configuration comes back.you hava to "flush" the rules once again.
@xros
xros / readme.md
Created January 25, 2022 23:54
Serverless Sign In to get user info from Firebase

Sign in via Google or Facebook, Firebase will give you a token. With this token, ask firebase, firebase will tell you who is the user.

You take firebase as your backend/database server, focus on developing apps only.

@xros
xros / readme.md
Created January 22, 2022 02:01
WeMe Startup -- A Concept of Personal Entrepreneurship

Today when I got up came across a concept that "WeMe" startup, which means We=Me when you are doing startup.

Here you could tell people you are "we", actually you are "me". But you are doing more than people think you are "me".

You can do better and more than just only "me", it's like "we" or to a level of enterprise.

And you are the most important person in the Startup, ofc.

You could be a full-stack engineer, designer, sales, manager at the same time. With the help of mostly helpful CI/CD, CRM, pipelines, trendy technologies and 3rd party corporations. Or you could find partners when you try.

@xros
xros / readme.md
Created January 21, 2022 00:59
Resolved: error: dst refspec refs/heads/main matches more than one

If you have this error, when you are pushing some codes to git server:

error: dst refspec refs/heads/main matches more than one

It might be that you locally/remotely has a tag called refs/heads/main

I believe you don't want this tag.

How to delete this tag both on remote git server and locally?

@xros
xros / app.py
Created January 20, 2022 19:22
Use Github's OAuth/Account to Login Your Server -- Python/Flask Example
# github生成的两把钥匙
client_id = 'e3a53e8921975c37fe3d'
client_secret = '739a252f5022855aadcc832a2facd86b1b836ef6'
from flask import Flask, \
redirect, \
jsonify
from furl import furl
import requests
import json
from flask import request
@xros
xros / generate_jwtRSA256_key_pair.sh
Last active February 9, 2022 01:30
generate JWT RSA256 key pair using openssl
# This RSA256 key is of 2048 bits long (valid between 1024-4096)
openssl genrsa -out jwtRSA256.private.key 2048
openssl rsa -in jwtRSA256.private.key -pubout -out jwtRSA256.public.key
# no need to input passphrase
cat jwtRSA256.private.key
cat jwtRSA256.public.key
# notice the jwtRSA256.public.key is in ssh-rsa format
@xros
xros / main.dart
Created January 9, 2022 16:12
StreamController from dart:async
import 'dart:async';
void addLessThanFive(StreamController controller, int value) {
if (value < 5) {
controller.sink.add(value);
} else {
controller.sink.addError(StateError('$value is not less than 5'));
}
}
@xros
xros / identify_focus_issue.py
Created December 28, 2021 11:12
Check window focus issue on macOS
#!/usr/bin/python
"""
Originally from: https://discussions.apple.com/thread/5470393
The root cause to this problem will be different for everyone as it's usually some rogue app or process that isn't working properly. In my case it was a Symantec utility called 'SymUIAgent.app'.
Follow these steps to identify what's causing this on your machine
Save the code on this file to your Desktop using id_issue.py as the filename: https://gist.github.com/iMerica/8928556/raw/73832a509de4dc5394cf1747b997ea1bd1b0 ff4e/identify_focus_issue.py
Open Terminal.app (Located in /Applications/Utilities/)
@xros
xros / main.dart
Created December 27, 2021 08:56
fizz buzz with Stream (Asynchronous Programming in Dart)
Stream<String> fizzBuzz(int n) async* {
for (var i = 1; i <= n; i++) {
// await Future.delayed(Duration(milliseconds: 500));
if (i % 3 == 0 && i % 5 == 0) {
yield 'fizz buzz';
} else if (i % 3 == 0) {
yield 'fizz';
} else if (i % 5 == 0) {
yield 'buzz';
} else {