Skip to content

Instantly share code, notes, and snippets.

View yusent's full-sized avatar
🏡
Working from home

Yusent Chig yusent

🏡
Working from home
View GitHub Profile
@yusent
yusent / custom_keys_git_ssh
Created April 26, 2023 02:42 — forked from vhermecz/custom_keys_git_ssh
Allow configuring multiple ssh deploy keys with git
#!/bin/bash
# Script to use custom ssh keys for various git repositories
# Run without arguments to get usage info.
#
# How it works:
# When used with SSH, git sends the path to the repository in the SSH command.
# @see: https://github.com/git/git/blob/e870325/connect.c#L1268
# We extract this info and search for a key with the name.
# Based on the source, this seems to be used format since v2.0 at least.
# @see: https://github.com/git/git/commit/a2036d7
#C Generated by copy.sh/life
x = 48, y = 25, rule = B3/S23
bo3bo4b2o9b3o3b3o12b2o$bo3b2o3b2o30b2o$bo3b2o5b2o5bo4bobo4bo$6bo5b2o5b
o4bobo4bo8b4o$19bo4bobo4bo4b2obo4bo$21b3o3b3o6b2obob2obo$39bo3b2ob2o$
21b3o3b3o9bo4bob2o$19bo4bobo4bo8b4o$19bo4bobo4bo$19bo4bobo4bo8b2o$40b
2o$21b3o3b3o$$$$$$$$2bo4bo16b2o$2ob4ob2o15bo$2bo4bo14bobo$21bo$21b2o!
@yusent
yusent / base16_random_theme
Last active April 6, 2021 01:17
A script to select a random base16 theme from base16-shell project for the current terminal ignoring some keywords
#!/bin/sh
scripts_dir="$HOME/.config/base16-shell/scripts"
if [ -d $scripts_dir ]
then
blacklist="light|brushtrees|cupertino|github|cupcake|tomorrow|fruit"
entries=($(ls -d "$scripts_dir"/* | grep -Ev "$blacklist"))
# Seed random generator
random=$$$(date +%s)
@yusent
yusent / TouchableItem.js
Created August 28, 2018 16:24
Touchable with native feedback for both Android and IOS
import React from 'react';
import {
Platform,
TouchableNativeFeedback,
TouchableOpacity,
View,
} from 'react-native';
const ANDROID_VERSION_LOLLIPOP = 21;
@yusent
yusent / host_connections_limiter.sh
Last active May 19, 2017 23:41
Workaround to allow a limited number of connections per host in an old Unix server
# Place this at the top of a file evaluated per connection (e.g. .profile)
max_allowed_connections=5
address=`echo "$SSH_CLIENT" | cut -f1 -d' '`
connections=`finger -l | grep "$address" | wc -l`
if [ "$connections" -gt "$max_allowed_connections" ]; then
exit 0
fi