Skip to content

Instantly share code, notes, and snippets.

View drawcode's full-sized avatar
😎
Shipping product

Ryan Christensen drawcode

😎
Shipping product
View GitHub Profile

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
@drawcode
drawcode / unity_ios_verificationsignature.md
Created January 14, 2024 18:50 — forked from BastianBlokland/unity_ios_verificationsignature.md
Way to get the game-center verification signature with Unity.

Even tho Unity has implemented a game-center api (Social api) it doesn't have a way to generate a verification signature, which you need to use game-center as a authentication method.

Luckily the objective-c code required is pretty straight forward. (Apple documentation: generateIdentityVerificationSignature)

#import <Foundation/Foundation.h>
#import <GameKit/GameKit.h>

typedef void (*IdentityVerificationSignatureCallback)(const char * publicKeyUrl, const char * signature, int signatureLength, const char * salt, int saltLength, const uint64_t timestamp, const char * error);

This version completely strips the page.

javascript:(function(){var n=document.getElementsByClassName('Box-body')[0].cloneNode(true);document.body.children[0].remove();document.body.appendChild(node);node.style.borderBottom = 'none';})();
@drawcode
drawcode / recover-deleted-branch.sh
Created October 11, 2022 02:32 — forked from umayr/recover-deleted-branch.sh
How to recover a deleted branch
## Pre-requisite: You have to know your last commit message from your deleted branch.
git reflog
# Search for message in the list
# a901eda HEAD@{18}: commit: <last commit message>
# Now you have two options, either checkout revision or HEAD
git checkout a901eda
# Or
git checkout HEAD@{18}
@drawcode
drawcode / git-tag-delete-local-and-remote.sh
Created September 14, 2022 01:07 — forked from mobilemind/git-tag-delete-local-and-remote.sh
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@drawcode
drawcode / how-software-companies-die.md
Last active January 4, 2022 23:44
How Software Companies Die

How Software Companies Die

Orson Scott Card

The environment that nurtures creative programmers kills management and marketing types - and vice versa.

Programming is the Great Game. It consumes you, body and soul. When you're caught up in it, nothing else matters. When you emerge into daylight, you might well discover that you're a hundred pounds

==========================
How Software Companies Die
==========================
- Orson Scott Card
The environment that nurtures creative programmers kills management and
marketing types - and vice versa.
Programming is the Great Game. It consumes you, body and soul. When
you're caught up in it, nothing else matters. When you emerge into
@drawcode
drawcode / MinimalAPIs.md
Created September 13, 2021 10:43 — forked from davidfowl/MinimalAPIs.md
Minimal APIs at a glance
@drawcode
drawcode / the-last-question-isaac-asimov.md
Created June 11, 2021 16:48
the-last-question-isaac-asimov.md

The Last Question by Isaac Asimov, LET THERE BE LIGHT!

Comic version

The Last Question by Isaac Asimov © 1956

The last question was asked for the first time, half in jest, on May 21, 2061, at a time when humanity first stepped into the light. The question came about as a result of a five dollar bet over highballs, and it happened this way:

Alexander Adell and Bertram Lupov were two of the faithful attendants of Multivac. As well as any human beings could, they knew what lay behind the cold, clicking, flashing face -- miles and miles of face -- of that giant computer. They had at least a vague notion of the general plan of relays and circuits that had long since grown past the point where any single human could possibly have a firm grasp of the whole.

@drawcode
drawcode / dotnet-csharp-github-list-get.cs
Created May 4, 2021 21:14
dotnet-csharp-github-list-get.cs - GitHub directory and file gets.
var httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.UserAgent.Add(
new ProductInfoHeaderValue("AppSpecificHeader", "1"));
var repo = "{org}/{repo}";
var contentsUrl = $"https://api.github.com/repos/{repo}/contents";
var contentsJson = await httpClient.GetStringAsync(contentsUrl);
var contents = (JArray)JsonConvert.DeserializeObject(contentsJson);
foreach(var file in contents)
{
var fileType = (string)file["type"];