Skip to content

Instantly share code, notes, and snippets.

View Sloaix's full-sized avatar
🐟
buddhist-style programming

Sloaix Sloaix

🐟
buddhist-style programming
View GitHub Profile
//
// DiskPermissionManager.swift
// uPic
//
// Created by Svend Jin on 2021/01/19.
// Copyright © 2021 Svend Jin. All rights reserved.
//
// entitlements 文件加入
// <key>com.apple.security.files.user-selected.read-only</key>
@journey-ad
journey-ad / luxun.fish
Created September 10, 2020 03:28
fish shell 可用的鲁迅语录 function
function luxun
set msgList (cat ~/motd.txt)
set pick (random 1 (count $msgList))
set pick $msgList[$pick]
printf (set_color F90)$pick
end
@liamengland1
liamengland1 / com.ss.sys.ces.gg.tt.class.java
Created July 3, 2020 23:53
com.ss.sys.ces.gg.tt from tiktok apk
package com.ss.sys.ces.gg;
import com.bytedance.frameworks.baselib.network.http.e.a;
import com.bytedance.frameworks.baselib.network.http.e;
import com.ss.a.b.b;
import com.ss.sys.ces.c;
import com.ss.sys.ces.out.StcSDKFactory;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Iterator;
@gmolveau
gmolveau / embed_sub.md
Last active April 5, 2023 16:00
Embed subtitle (soft) in mp4/mkv file with ffmpeg without re-encoding

solution from https://stackoverflow.com/a/17584272/2627873

This solution adds the subtitles to the video as a separate optional (and user-controlled) subtitle track.

So you can choose the subtitle in VLC for example, it's not hard-coded or burned-in. And it won't re-encode the entire file so it's really fast.

  • ffmpeg is required
  • movie = great_movie.mp4 (works with mkv too)
  • subtitle = great_movie.english.srt
const key = (x, y) => {
return x + ',' + y
}
const unkey = k => {
return k.split(',').map(s => parseInt(s))
}
/* Given an x, y coordinate and a hashmap "x,y" => boolean values that indicate whether or not the tile at that
coordinate is blocked, this function will calculate the bitmask sum of the given coordinate. */
function computeBitmask(x, y, blockedCells) {
@phuysmans
phuysmans / gist:4f67a7fa1b0c6809a86f014694ac6c3a
Created January 8, 2018 09:29
docker compose health check example
version: '2.1'
services:
php:
tty: true
build:
context: .
dockerfile: tests/Docker/Dockerfile-PHP
args:
version: cli
volumes:
@Sloaix
Sloaix / byte_array_bit_shift.cpp
Last active November 27, 2017 01:33
左/右移字节数组的bit位,支持bit位循环移动。left/right shift the bit of byte array,support circular shift.
/**
*
* @param bytes 目标数组
* @param circular 是否循环移位
*/
void shiftLeft(char unsigned *bytes, bool circular) {
int size = sizeof bytes;
int highBitOfHeadByte = (bytes[0] & 0x80) == 0x80 ? 1 : 0;//获取头字节的最高位bit
@simoncos
simoncos / golang_on_rpi.md
Last active March 30, 2024 17:56 — forked from konradko/golang_on_rpi.md
Install Golang 1.9 on Raspberry Pi

Install Golang 1.9:

wget https://storage.googleapis.com/golang/go1.9.linux-armv6l.tar.gz
sudo tar -C /usr/local -xzf go1.9.linux-armv6l.tar.gz
export PATH=$PATH:/usr/local/go/bin # put into ~/.profile

If already installed old golang with apt-get:

@rhyttr
rhyttr / Android 6.0.1 (Build M4B30Z) Root for Nexus 5
Last active June 12, 2022 14:13
Android 6.0.1 (Build M4B30Z) Root for Nexus 5
# Download latest Android image, "hammerhead" for Nexus 5 (GSM/LTE)
https://developers.google.com/android/nexus/images#hammerhead
# Download latest TWRP
https://dl.twrp.me/hammerhead/
# Download latest SuperSu
https://download.chainfire.eu/supersu
Enable USB debugging.
@pierre-b
pierre-b / config.fish
Created March 6, 2017 10:03
golang fish shell config
# config file
# vim ~/.config/fish/config.fish
# reload the config
# source ~/.config/fish/config.fish
# set the workspace path
set -x GOPATH /users/my-username/go
# add the go bin path to be able to execute our programs