Skip to content

Instantly share code, notes, and snippets.

View dontcry2013's full-sized avatar

Zac Qin dontcry2013

View GitHub Profile
@wxiaoguang
wxiaoguang / mysql-ctl.sh
Last active September 28, 2021 07:57
A mysql & mariadb server helper (use downloaded generic binary package). You can run multi instances on one server, each instance uses their own data & log directory.
#!/bin/bash
# how it works:
#
# put mysql.cnf and mysql.env in a directory for an instance, cd to this directory, run `mysql-ctl.sh ...`
# or run `MYSQL_INSTANCE_ROOT=the_directory mysql-ctl.sh ...`
#
# mysql.cnf keeps all configurations except directory-related things (eg: do not set data or log dir in mysql.cnf)
# the mysql.cnf and directory-related configs will be automatically merged into the MYSQL_INSTANCE_CONFIG_FINAL file
#
@freyta
freyta / tutorial.md
Last active December 24, 2023 09:56
Patching the 7Eleven 1.7.1 APK for mock location, root and "foreign APK" installation

Required files: jadx -> https://github.com/skylot/jadx/releases APK Easy Tool to easily decompile/recompile the APK -> https://forum.xda-developers.com/android/software-hacking/tool-apk-easy-tool-v1-02-windows-gui-t3333960 7 Eleven Fuel App APK ripped off your phone or download from here -> https://apkpure.com/7-eleven-fuel/au.com.fuel7eleven A Google Maps API key -> https://developers.google.com/maps/documentation/android-sdk/signup

I'll be explaining how to remove the mock location check and allow root access for version 1.7.1 in this little guide.

Step 1 - Install the downloaded APK onto your phone and open it up. What happens? It closes straight away. Bugger! Lets take a look at our code and see what could be causing that.

#!/bin/sh
function wait_mysql() {
while ! (docker exec -it $1 mysql -pmysql -e "SELECT 1;" > /dev/null)
do
echo "Wait 5s for $1..."
sleep 5
done
}
@mindplay-dk
mindplay-dk / image-url.ts
Last active September 28, 2023 15:25
Rotate image preview to compensate for EXIF orientation (Javascript / Typescript)
// Based on: https://stackoverflow.com/a/46814952/283851
/**
* Create a Base64 Image URL, with rotation applied to compensate for EXIF orientation, if needed.
*
* Optionally resize to a smaller maximum width - to improve performance for larger image thumbnails.
*/
export async function getImageUrl(file: File, maxWidth: number|undefined) {
return readOrientation(file).then(orientation => applyRotation(file, orientation || 1, maxWidth || 999999));
}
@jorben
jorben / openssl_tool.txt
Last active August 6, 2018 02:06
RSA加解密,签名、验签文件
1) Generate RSA key:
$ openssl genrsa -out key.pem 1024
$ openssl rsa -in key.pem -text -noout
2) Save public key in pub.pem file:
$ openssl rsa -in key.pem -pubout -out pub.pem
$ openssl rsa -in pub.pem -pubin -text -noout
3) Encrypt some data:
@knight42
knight42 / naive-request.js
Last active December 8, 2016 08:37
naive promisified request
#!/usr/bin/node
"use strict";
const net = require('net');
const url = require('url');
const qs = require('querystring');
function request(opts) {
if(! /^https?:\/\//.test(opts.url)) opts.url = `http://${opts.url}`;
@subfuzion
subfuzion / curl.md
Last active June 29, 2024 16:04
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@jorben
jorben / git_toturial
Created November 27, 2015 02:15 — forked from guweigang/git_toturial
git命令大全
git init # 初始化本地git仓库(创建新仓库)
git config --global user.name "xxx" # 配置用户名
git config --global user.email "xxx@xxx.com" # 配置邮件
git config --global color.ui true # git status等命令自动着色
git config --global color.status auto
git config --global color.diff auto
git config --global color.branch auto
git config --global color.interactive auto
git config --global --unset http.proxy # remove proxy configuration on git
git clone git+ssh://git@192.168.53.168/VT.git # clone远程仓库
@anvaka
anvaka / 00.Intro.md
Last active June 28, 2024 12:23
npm rank

npm rank

This gist is updated daily via cron job and lists stats for npm packages:

  1. Top 1,000 most depended-upon packages
  2. Top 1,000 packages with largest number of dependencies
  3. Top 1,000 packages with highest PageRank score
@revolunet
revolunet / python-es6-comparison.md
Last active April 22, 2024 19:22
# Python VS JavaScript ES6 syntax comparison

Python VS ES6 syntax comparison

Python syntax here : 2.7 - online REPL

Javascript ES6 via Babel transpilation - online REPL

Imports

import math