Skip to content

Instantly share code, notes, and snippets.

View kdbcinco's full-sized avatar
🏠
(I wishi I was) working from home

Karl Dominick Cinco kdbcinco

🏠
(I wishi I was) working from home
  • Ilocos Sur, Philippines
View GitHub Profile
@kdbcinco
kdbcinco / github_bitbucket_multiple_ssh_keys.md
Created January 24, 2024 08:29 — forked from yinzara/github_bitbucket_multiple_ssh_keys.md
Managing SSH keys and repo cloning using multiple accounts on GitHub and BitBucket

Why Multiple SSH keys?

There are numerous reasons you may need to use multiple SSH keys for accessing GitHub and BitBucket

You may use the same computer for work and personal development and need to separate your work.

When acting as a consultant, it is common to have multiple GitHub and/or BitBucket accounts depending on which client you may be working for.

You may have different projects you're working on where you would like to segregate your access.

@kdbcinco
kdbcinco / docker.md
Created June 15, 2022 01:48 — forked from FreddieOliveira/docker.md
This tutorial shows how to run docker natively on Android, without VMs and chroot.

Docker on Android 🐋📱

Edit 🎉

All packages, except for Tini have been added to termux-root. To install them, simply pkg install root-repo && pkg install docker. This will install the whole docker suite, left only Tini to be compiled manually.


Summary

@kdbcinco
kdbcinco / windows-terminal.shades-of-purple.json
Created August 26, 2020 07:01
Shades of Purple for Windows Terminal
{
"name": "Shades of Purple",
"background": "#1e1d40",
"foreground": "#ffffff",
"black": "#000000",
"blue": "#6943ff",
"brightBlack": "#686868",
"brightBlue": "#6871ff",
"brightCyan": "#79e8fb",
"brightGreen": "#43d426",
@kdbcinco
kdbcinco / useCounter.ts
Last active August 15, 2020 05:13
Various Hooks
import { useCallback, useState } from 'react';
export default function useCounter(initialValue: number) {
const [state, setState] = useState(initialValue);
const increment = useCallback((value: number = 1) => setState(current => current + value), []);
const decrement = useCallback((value: number = 1) => setState(current => current - value), []);
const reset = useCallback(() => setState(initialValue), [initialValue]);
return { state, increment, decrement, reset } as const;
}
@kdbcinco
kdbcinco / git-find-large-files.sh
Created July 31, 2020 04:21
How to find/identify large commits in git history?
# https://stackoverflow.com/questions/10622179/how-to-find-identify-large-commits-in-git-history
# https://stackoverflow.com/a/42544963/4121010
git rev-list --objects --all \
| git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' \
| sed -n 's/^blob //p' \
| sort --numeric-sort --key=2 \
| cut -c 1-12,41- \
| $(command -v gnumfmt || echo numfmt) --field=2 --to=iec-i --suffix=B --padding=7 --round=nearest
@kdbcinco
kdbcinco / getImageSize.ts
Created July 12, 2020 06:18
Promise-ified Image.getSize()
import { Image } from 'react-native';
export interface ImageDimensions {
width: number;
height: number;
}
export default function getImageSize(uri: string): Promise<ImageDimensions> {
return new Promise((resolve, reject) =>
Image.getSize(
public class BindingProxy : Freezable
{
#region Overrides of Freezable
protected override Freezable CreateInstanceCore()
{
return new BindingProxy();
}
#endregion
@kdbcinco
kdbcinco / 1.Widget.cs
Created October 6, 2016 02:05 — forked from Lobstrosity/1.Widget.cs
Mapping Parent-Child Relationships with Dapper
public class Widget
{
public int Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
}
<%
' ------------------------------------------------------------------------------
' Author: Lewis Moten
' Date: March 19, 2002
' ------------------------------------------------------------------------------
' Field class represents interface to data passed within one field
'
' ------------------------------------------------------------------------------
Class clsField
@kdbcinco
kdbcinco / AESGCM.cs
Created June 4, 2016 08:23 — forked from jbtule/AESGCM.cs
I have two code examples that I wrote for best practices encrypting a string in c#. They are both using authenticated encryption. http://stackoverflow.com/a/10366194/637783
/*
* This work (Modern Encryption of a String C#, by James Tuley),
* identified by James Tuley, is free of known copyright restrictions.
* https://gist.github.com/4336842
* http://creativecommons.org/publicdomain/mark/1.0/
*/
using System;
using System.IO;
using System.Text;