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
@drawcode
drawcode / publickey-git-error.markdown
Created April 5, 2020 03:45 — forked from adamjohnson/publickey-git-error.markdown
Fix "Permission denied (publickey)" error when pushing with Git

"Help, I keep getting a 'Permission Denied (publickey)' error when I push!"

This means, on your local machine, you haven't made any SSH keys. Not to worry. Here's how to fix:

  1. Open git bash (Use the Windows search. To find it, type "git bash") or the Mac Terminal. Pro Tip: You can use any *nix based command prompt (but not the default Windows Command Prompt!)
  2. Type cd ~/.ssh. This will take you to the root directory for Git (Likely C:\Users\[YOUR-USER-NAME]\.ssh\ on Windows)
  3. Within the .ssh folder, there should be these two files: id_rsa and id_rsa.pub. These are the files that tell your computer how to communicate with GitHub, BitBucket, or any other Git based service. Type ls to see a directory listing. If those two files don't show up, proceed to the next step. NOTE: Your SSH keys must be named id_rsa and id_rsa.pub in order for Git, GitHub, and BitBucket to recognize them by default.
  4. To create the SSH keys, type ssh-keygen -t rsa -C "[email protected]". Th
// For use with e.g. Media Player Classic
// (c) Mindbleach 2020 , no rights reserved
// Treat as licensed under MIT if that makes life easier for you.
// After https://www.reddit.com/r/ContagiousLaughter/comments/fim6di/watching_twilight_on_a_poorly_hung_projector/
sampler s0 : register(s0);
float4 main(float2 tex : TEXCOORD0) : COLOR
{
function getParameterByName (name)
{
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regexS = "[\\?&]" + name.toLowerCase() + "=([^&#]*)";
var regex = new RegExp(regexS);
var results = regex.exec(window.location.search.toLowerCase());
if (results == null)
return "";
else
return decodeURIComponent(results[1].replace(/\+/g, " "));
@drawcode
drawcode / .gpu-instancing.md
Last active July 29, 2024 09:27
Unity GPU Instancing

https://docs.unity3d.com/Manual/GPUInstancing.html

GPU Instancing (Unity)

Introduction

Use GPU Instancing to draw (or render) multiple copies of the same Mesh at once, using a small number of draw calls. It is useful for drawing objects such as buildings, trees and grass, or other things that appear repeatedly in a Scene .

GPU Instancing only renders identical Meshes with each draw call, but each instance can have different parameters (for example, color or scale) to add variation and reduce the appearance of repetition.

@drawcode
drawcode / drawcode-pulse-slow-blue.glsl
Last active September 1, 2019 14:50
drawcode-shaders.glsl
//----from http://glslsandbox.com/e#56769.0
//----Removed mouse-dependency, asymetrical from start
//----
#ifdef GL_ES
precision mediump float;
#endif
uniform float time;
uniform vec2 mouse;
@drawcode
drawcode / maskunity.cs
Last active July 1, 2019 10:56
maskunity.cs
/*
https://answers.unity.com/questions/316064/can-i-obscure-an-object-using-an-invisible-object.html
You can use a special shader that only writes to the depth buffer. That's not so difficult, but you may end with a black area in the screen! The problem is: since this shader doesn't actually draw anything, the area behind the object will remain with the original image, which is defined by the camera's Clear Flags. In order to avoid this, you must handle the rendering order so that the background items are rendered first, then the invisible object, and finally the objects that may be obscured. You can do that by setting the property material.renderQueue of each object, assigning greater values to the ones that should be rendered last (read more about renderQueue values in the shader docs).
The shader itself could be as simple as this one:
*/
Shader "Custom/InvisibleMask" {
SubShader {
@drawcode
drawcode / dsigsample.xml
Last active June 26, 2019 07:07
xmldsig.md
<?xml version="1.0" encoding="UTF-8"?>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
<SignedInfo>
<CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
<Reference URI="#object">
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
<DigestValue>OPnpF/ZNLDxJ/I+1F3iHhlmSwgo=</DigestValue>
</Reference>
</SignedInfo>
@drawcode
drawcode / xmldigsigobject.java
Created June 14, 2019 23:31
XMl Digital Signature with References and Custom Objects
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
<SignedInfo>
<CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments"/>
<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#dsa-sha1"/>
<Reference URI="#object">
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<DigestValue>7/XTsHaBSOnJ/jXD5v0zL6VKYsk=</DigestValue>
</Reference>
</SignedInfo>
<SignatureValue>
@drawcode
drawcode / RSAPKCS1SHA256SignatureDescription.cs
Created June 9, 2019 01:37
RSAPKCS1SHA256SignatureDescription.cs
using System.Security.Cryptography;
namespace Sample
{
/// <summary>
/// SignatureDescription impl for http://www.w3.org/2001/04/xmldsig-more#rsa-sha256
/// </summary>
public class RSAPKCS1SHA256SignatureDescription : SignatureDescription
{
/// <summary>
@drawcode
drawcode / imdb.py
Created June 4, 2019 21:09
imdb.py
__author__ = 'Sid'
import requests
from bs4 import BeautifulSoup
import csv
# search = "game of thrones"
search = "person of interest"
# search = "friends"
# search = "rome"