Skip to content

Instantly share code, notes, and snippets.

View XinyueZ's full-sized avatar
🙊
Make sense, don't touch

ChrisDEV XinyueZ

🙊
Make sense, don't touch
View GitHub Profile
@XinyueZ
XinyueZ / svm.json
Created June 9, 2025 14:26
Shot video maker
{
"name": "Faceless Shorts",
"nodes": [
{
"parameters": {
"model": {
"__rl": true,
"value": "gpt-4o-mini",
"mode": "list",
"cachedResultName": "gpt-4o-mini"
@XinyueZ
XinyueZ / compare_drawable_bitmap.kt
Last active March 19, 2025 11:06
Compare drawable or bitmap content
// Usage:
// drawable1.bytesEqualTo(drawable2)
// drawable1.pixelsEqualTo(drawable2)
// bitmap1.bytesEqualTo(bitmap1)
// bitmap1.pixelsEqualTo(bitmap2)
fun <T : Drawable> T.bytesEqualTo(t: T?) = toBitmap().bytesEqualTo(t?.toBitmap(), true)
fun <T : Drawable> T.pixelsEqualTo(t: T?) = toBitmap().pixelsEqualTo(t?.toBitmap(), true)
@XinyueZ
XinyueZ / i-ask.sh
Last active July 14, 2023 07:30
i-ask.sh, a bash to use openAI api
#!/bin/bash
if [ "$(uname)" == "Darwin" ]; then
# This is a Mac, so use Homebrew
echo "Installing jq with Homebrew..."
brew install jq
else
# Assume this is a Linux system and use apt-get
echo "Installing jq with apt-get..."
sudo apt-get update
@XinyueZ
XinyueZ / gist:db12dfead16476a63c075121d9c3aa4a
Created July 3, 2023 21:41
ubuntu, set launcher to center, similar to MacOS
gsettings set org.gnome.shell.extensions.dash-to-dock extend-height false
gsettings set org.gnome.shell.extensions.dash-to-dock dock-position BOTTOM
gsettings set org.gnome.shell.extensions.dash-to-dock transparency-mode FIXED
gsettings set org.gnome.shell.extensions.dash-to-dock dash-max-icon-size 64
gsettings set org.gnome.shell.extensions.dash-to-dock unity-backlit-items true
@XinyueZ
XinyueZ / collpasePanel.java
Last active May 30, 2023 10:41
open close notification-bar
/*
For opening and closing the notification-bar programmatically. Here is an example for closing.
<uses-permission android:name=“android.permission.EXPAND_STATUS_BAR” />
It might be an unofficial info.
http://stackoverflow.com/questions/5029354/how-can-i-programmatically-open-close-notifications-in-android http://stackoverflow.com/questions/13766789/android-how-to-collapse-status-bar-on-android-4-2
*/
private static void collpasePanel(Context _context) {
try {
@XinyueZ
XinyueZ / pixel_rnn_dataset_logic.py
Created November 12, 2022 00:08
PixelRNNs, dataset logic
def pad_nulls(arraylike, seq_len, input_size):
'''
Pad nulls to the end of the arraylike, so that the length of the arraylike
is divisible by the batch_size.
'''
if len(arraylike)==0:
arraylike = np.zeros( (seq_len, input_size), dtype=np.float32)
remainder = len(arraylike) % seq_len
if remainder != 0:
@XinyueZ
XinyueZ / seq2seq_keras.py
Last active November 11, 2022 23:02
PixelRNNs Many-To-Many
initializer=keras.initializers.he_uniform
#@title Encoder
def create_encoder(input_shape):
inputs = keras.layers.Input(shape=input_shape)
x = keras.layers.Conv1D(filters=HIDDEN_SIZE,
kernel_size=4,
strides=1,
input_shape=input_shape,
kernel_initializer=initializer,
@XinyueZ
XinyueZ / seq2vec.py
Created November 7, 2022 20:48
PixelRNNs Many-To-One
class GenModel(nn.Module):
def _init_weights(self, module):
if module.state_dict().get('weight') != None:
if type(module) == nn.BatchNorm1d:
nn.init.zeros_(module.bias)
else:
nn.init.kaiming_uniform_(module.weight)
def __init__(self, input_size, hidden_size, num_layers, bidirectional):
super().__init__()
@XinyueZ
XinyueZ / seq2seq.py
Created November 7, 2022 20:47
PixelRNNs Many-To-Many
class GenModel(nn.Module):
def _init_weights(self, module):
if module.state_dict().get('weight') != None:
if type(module) == nn.BatchNorm1d:
nn.init.zeros_(module.bias)
else:
nn.init.kaiming_uniform_(module.weight)
def __init__(self, input_size, hidden_size, num_layers, bidirectional):
super().__init__()
@XinyueZ
XinyueZ / image-reduction-with-k-means.ipynb
Created August 28, 2022 14:40
Image Reduction with K-Means.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.