Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
"""
get_genshin_wishes.py
A Python rewrite of get_genshin_wishes.sh that extracts the Genshin Impact wish‑history URL from
the recent WebKit network cache and copies it to the macOS clipboard.
Author: <your name>
"""
@tongoclinh
tongoclinh / regex_cleanup.sh
Created March 2, 2022 13:06
Regex cleanup for OCR result.
#!/bin/bash
# prerequisite: perl and sd tool [https://github.com/chmln/sd]
# first, use regex to clear header and footer, depending on content of the file
# replace curly quote to straight quote
sd '[“”]' '"' $1
sd '[‘’]' "\'" $1
mQRSurfaceView = new SurfaceView(this);
FrameLayout.LayoutParams lParams = new FrameLayout.LayoutParams(
FrameLayout.LayoutParams.WRAP_CONTENT,
FrameLayout.LayoutParams.WRAP_CONTENT);
lParams.leftMargin = 100;
lParams.topMargin = 0;
lParams.gravity = Gravity.TOP | Gravity.START;
mFrameLayout.addView(mQRSurfaceView, lParams);
@tongoclinh
tongoclinh / change.txt
Created November 5, 2018 01:43
Các thay đổi để optimize api cho MJ 25.0.0
- các thay đổi api chỉ áp dụng cho subversion/appversion 25.0.0 trở lên
- bỏ update/updatecoins, chỉ sử dụng update/index
api update/index
- chuyển các cụm sticker, sticker_free, sticker_paid, dictPrice, dictPacketTienTe, sort_language, language_display sang api khác (appinfo)
- bỏ device_id, server, referer_status, referer_day_active, install_time
- có thể sử dụng cơ chế zip (do list message khá dài)
api sampledata/location
auto render_texture = RenderTexture::create(this->getContentSize().width, this->getContentSize().height);
render_texture->setPosition(this->getContentSize() / 2);
this->addChild(render_texture, 10000);
auto brush = Sprite::create("water.png");
brush->retain();
auto draw_overlay = ui::Layout::create();
draw_overlay->setContentSize(this->getContentSize());
draw_overlay->setTouchEnabled(true);
@tongoclinh
tongoclinh / guiBai.cpp
Created March 5, 2016 02:02
Các hàm bổ sung cho việc gửi bài
std::vector<std::pair<GBCardInfo, int> > GBRoomTala::getCardGui() {
auto player = getLocalPlayer();
std::vector<std::pair<std::vector<GBCardInfo>, int> >listPhom;
for (auto p : players) {
for (auto h : p.cards_Phom) {
listPhom.push_back(std::make_pair(h, p.id_inroom));
}
}
@tongoclinh
tongoclinh / gist:9edf84ce1ab3316db30f
Created January 8, 2015 01:25
Enable text selection in QuickLock on OS X
defaults write com.apple.finder QLEnableTextSelection -bool true
@tongoclinh
tongoclinh / CALayerAnimateCorner.m
Last active August 29, 2015 14:04
Animate changing corner radius of CALayer
CABasicAnimation *cornerAnim = [CABasicAnimation animationWithKeyPath:@"cornerRadius"];
cornerAnim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
cornerAnim.fromValue = [NSNumber numberWithFloat:40.0f];
cornerAnim.toValue = [NSNumber numberWithFloat:5.0f];
cornerAnim.duration = 1.0;
[self.view.layer addAnimation:cornerAnim forKey:@"cornerRadius"];
self.view.layer = cornerAnim.toValue;
//self is UIViewController sub-class