Skip to content

Instantly share code, notes, and snippets.

@handleman
handleman / Chat.jsx
Last active October 30, 2022 11:11
sendbird chat customized
import SendbirdProvider from "@sendbird/uikit-react/SendbirdProvider";
import CustomizedScreen from './ChatScreen';
import "@sendbird/uikit-react/dist/index.css";
const APP_ID = 'FFFFF-20ED-4624-84C6-FFFFFFF';
const USER_ID = 'pavel-test-666';
const isSSR = () => typeof window === 'undefined';
export const Chat = () => {
return (
@handleman
handleman / hero.ts
Created March 30, 2021 14:10 — forked from brennanMKE/hero.ts
Example of Mongoose with TypeScript and MongoDb
import * as mongoose from 'mongoose';
export let Schema = mongoose.Schema;
export let ObjectId = mongoose.Schema.Types.ObjectId;
export let Mixed = mongoose.Schema.Types.Mixed;
export interface IHeroModel extends mongoose.Document {
name: string;
power: string;
@handleman
handleman / jq to filter by value.md
Last active September 15, 2020 15:26 — forked from ipbastola/jq to filter by value.md
JQ to filter JSON by value

JQ to filter JSON by value and produce new json file with filtered data

Syntax: cat <filename> | jq -c '[.[] | select( .<key> | contains("<value>"))]' > <path_to_new_file.json>

Example: To get json record having _id equal 611

cat my.json | jq -c '[.[] | select( ._id | contains(611))]' > ./myProject/jsons/filtered.json

Remember: if JSON value has no double quotes (eg. for numeric) to do not supply in filter i.e. in contains(611)

@handleman
handleman / pre-commit.sh
Created June 8, 2020 08:37
pre-commit hook to check size of the image, to show list of it and prompt user to continue
#!/usr/bin/env bash
declare -r MAX_IMAGE_SIZE_MB=1
declare -r CURRENT_DIR="$(pwd)"
declare -r IMAGES_MASK=".*\.(webp|png|jpg|jpeg|gif)$"
HAS_ERROR=""
OIFS="$IFS"
IFS=$'\n'
@handleman
handleman / pre-commit
Created June 4, 2020 08:21 — forked from jiskanulo/pre-commit
Git pre-commit hook: detect file size over 100MB
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".
# Redirect output to stderr.
@handleman
handleman / avd.sh
Created April 22, 2020 12:04
Config to run clamAv on macOs with automatic scan once a week. Full configuration for using clamAv antivirus on regular base with automatic scan once a week. It consist of the sh script which perform clamav signatures database update and scanner run, both with appropriate .plist xml files.
#!/usr/bin/env bash
freshclam && clamdscan -i --multiscan --move=/Users/handleman/quarantine ~
export PATH="/usr/local/sbin:$PATH"
export ANDROID_HOME=/Users/handleman/Library/Android/sdk
export PATH=${PATH}:/Users/handleman/Library/Android/sdk/platform-tools:/Users/handleman/Library/Android/sdk/tools
export JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
export ANDROID_SDK=$HOME/Library/Android/sdk
export PATH=$ANDROID_SDK/emulator:$ANDROID_SDK/tools:$PATH%
@handleman
handleman / gist:592e5fe7adda8da98a046e6ffc7cea1c
Last active March 6, 2019 13:23 — forked from sgergely/gist:3793166
Midnight Commander Keyboard Shortcuts for Mac OSX
----- Esc -----
Quick change directory: Esc + c
Quick change directory history: Esc + c and then Esc + h
Quick change directory previous entry: Esc + c and then Esc + p
Command line history: Esc + h
Command line previous command: Esc + p
View change: Esc + t (each time you do this shortcut a new directory view will appear)
Print current working directory in command line: Esc + a
Switch between background command line and MC: Ctrl + o
Search/Go to directory in active panel: Esc + s / Ctrl + s then start typing directory name
@handleman
handleman / git.sh
Created March 5, 2019 08:27
git got error: cannot lock ref
#https://www.kernel.org/pub/software/scm/git/docs/git-gc.html
git gc --prune=now
@handleman
handleman / bash.sh
Created March 5, 2019 08:03
point bash output to file . How do I save terminal output to a file? Based on the answer here https://askubuntu.com/questions/420981/how-do-i-save-terminal-output-to-a-file
#Yes it is possible, just redirect the output to a file:
SomeCommand > SomeFile.txt
#Or if you want to append data:
SomeCommand >> SomeFile.txt
#If you want stderr as well use this:
SomeCommand &> SomeFile.txt
#or this to append: