Skip to content

Instantly share code, notes, and snippets.

View lsanotes's full-sized avatar

LIU PEIPEI lsanotes

View GitHub Profile
@JolandaVerhoef
JolandaVerhoef / .Unlocking the Power of CameraX in Jetpack Compose.md
Last active September 26, 2025 14:30
Code snippets for Medium blog post "Unlocking the Power of CameraX in Jetpack Compose"

Code snippets used in the blog post series "Unlocking the Power of CameraX in Jetpack Compose". I will add snippets as blog posts are released!

Each file can be copied as-is to the MainActivity.kt of a new project. However, it doesn't include any library dependencies or adaptations to AndroidManifest.xml, so make sure to follow the steps in the blog posts themselves to get a working sample.

@Jthomas54
Jthomas54 / okhttp3.WebviewCookieHandler.java
Last active May 29, 2019 04:59
Cookie jar that handles syncing okhttp cookies with Webview cookie manager
import android.webkit.CookieManager;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import okhttp3.Cookie;
import okhttp3.CookieJar;
import okhttp3.HttpUrl;
@greggirwin
greggirwin / draw-red-logo.red
Created February 22, 2018 23:20
Draw commands for Red logos.
Red []
view [
base 200x336 white draw [
pen #eeac29
fill-pen #eeac29 polygon 100x2 100x65 72x49
fill-pen #bc822d polygon 100x2 100x65 128x49
pen #d41c18
fill-pen #d41c18 polygon 100x84 100x146 37x109 64x63
@Warchant
Warchant / sonarqube-docker-compose.yml
Last active June 30, 2025 15:13
docker-compose file to setup production-ready sonarqube
version: "3"
services:
sonarqube:
image: sonarqube
expose:
- 9000
ports:
- "127.0.0.1:9000:9000"
networks:

How to Download iOS Simulator (Xcode) in Command Line and Install it

For faster connection speed and more flexibility.

Steps

  1. Start Xcode in command line by running this in commandline /Applications/Xcode.app/Contents/MacOS/Xcode
  2. Start downloading of the simulator
  3. Cancel it. YES CANCEL IT!
  4. You will get a message like this:
@nathanchrs
nathanchrs / set-proxy
Created February 23, 2017 12:52
Bash script to set proxy on Linux
#!/usr/bin/env bash
# Sets proxy settings.
# Run using `source` command. apt-get proxy settings requires sudo privileges.
# By nathanchrs.
# Configuration
# PROXY_HOST=""
# PROXY_USER=""
# PROXY_PASSWORD=""
@abiosoft
abiosoft / Caddyfile
Created September 18, 2016 16:16
Caddy wordpress docker-compose
:80
root /usr/src/wordpress
gzip
fastcgi / wordpress:9000 php
rewrite {
if {path} not_match ^\/wp-admin
to {path} {path}/ /index.php?_url={uri}
}
log stdout
errors stderr
@brucevanfdm
brucevanfdm / setUpIndicatorWidth.java
Last active June 12, 2020 03:38
通过反射修改TabLayout Indicator的宽度
/**
* 通过反射修改TabLayout Indicator的宽度(仅在Android 4.2及以上生效)
*/
private void setUpIndicatorWidth() {
Class<?> tabLayoutClass = tabLayout.getClass();
Field tabStrip = null;
try {
tabStrip = tabLayoutClass.getDeclaredField("mTabStrip");
tabStrip.setAccessible(true);
} catch (NoSuchFieldException e) {
@ashfurrow
ashfurrow / Fresh macOS Setup.md
Last active October 14, 2024 10:28
All the stuff I do on a fresh macOS Installation

Apps to install from macOS App Store:

  • Pastebot
  • GIF Brewery
  • Slack
  • Keynote/Pages/Numbers
  • 1Password
  • OmniFocus 3
  • Airmail 3
  • iA Writer
@lykmapipo
lykmapipo / GridStream.js
Created June 18, 2016 09:57 — forked from psi-4ward/GridStream.js
NodeJS MongoDB-GridFS Video range stream example Lets your browser seek/jump wihin the video-playback.
var app = require('express')();
var GridStore = require('mongodb').GridStore;
var ObjectID = require('mongodb').ObjectID;
var MongoClient = require('mongodb').MongoClient;
var Server = require('mongodb').Server;
var dbConnection;
MongoClient.connect("mongodb://localhost:27017/ersatz?auto_reconnect", {journal: true}, function(err, db) {
dbConnection = db;
app.listen(3000);