Skip to content

Instantly share code, notes, and snippets.

Avatar

Hugh Yar yar00001

View GitHub Profile
@yar00001
yar00001 / anki_flag
Last active Aug 7, 2020
updating the anki_flag from patch call
View anki_flag
843
43
863
121
173
124
272
39
536
426
View chert.java
public boolean hasValidPath(int[][] grid) {
Map<Integer, int[][]> map = new HashMap<>();
// top, right, bottom, left
map.put(1, new int[][]{{-1}, {3,5}, {-1}, {4,6}});
map.put(2, new int[][] {{3,4}, {-1}, {5,6}, {-1}});
map.put(3, new int[][] {{-1}, {-1}, {2,5,6}, {1,4,6}});
map.put(4, new int[][] {{-1}, {1,3,5}, {2,5,6}, {-1}});
map.put(5, new int[][] {{2,3,4}, {-1}, {-1}, {1,4, 6}});
map.put(6, new int[][] {{2, 3, 4}, {1, 3, 5}, {-1}, {-1}});
View L1376_TimeToInformAll.java
package bfs;
import org.junit.Test;
import java.util.*;
/**
* https://leetcode.com/problems/time-needed-to-inform-all-employees/description/
*
*/
@yar00001
yar00001 / ToggleVSCode.scpt
Last active Jan 21, 2020
Toggle VSCode using AppleScript
View ToggleVSCode.scpt
set systemAppName to "Code"
set appName to "Visual Studio Code"
if application appName is running then
tell application "System Events"
if visible of process systemAppName is false then
tell application "System Events"
tell process systemAppName
set visible to false
set visible to true
@yar00001
yar00001 / iterm2-solarized.md
Created Jun 22, 2019 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font + [Powerlevel9k] - (macOS)
View iterm2-solarized.md

Default

Default

Powerlevel9k

Powerlevel9k

View sample.py
import boto3
from io import BytesIO
from gzip import GzipFile
import re
BUCKET_NAME = 'bucket_name'
PREFIX = 'RMS-DB/Device/2019/05/09/'
KMS_KEY_ID = 'arn:aws:kms:us-east-1:something:key/something'
VALID_FORMAT = '|||||'
View ABStringGenerator.java
/**
* https://arena.topcoder.com/?fbclid=IwAR2AvwfSd16RJinXVzPYsYHW6zxs99mbT6zo25tVgxsTmL5EIArjS1HgPho#/u/practiceCode/16319/46378/13642/1/325040
*/
public class ABStringGenerator {
public String generateABString(int n, int k) {
// ToDo: add null/edge check
// Get the order
PriorityQueue<Integer> queue = findSegments(n, k);
@yar00001
yar00001 / email-generator.js
Last active Jun 4, 2018
Copies a random Email Address to clipboard
View email-generator.js
/**
* 1. Create bookmark.
* 2. Edit bookmark URL(Chrome) / Location(Firefox) and copy the code.
*/
javascript:(function(){
var el = document.createElement('textarea');
var mult = 99999999;
var emailAddress = "yarhooma+" + Math.floor(Math.random() * mult) + "@amazon.com";
el.value = emailAddress;
@yar00001
yar00001 / Program.cs
Created Mar 25, 2017
RSA Encrypt/Decrypt
View Program.cs
using System;
using System.Security.Cryptography;
using System.Text;
namespace ConsoleApp1
{
class Program
{
private static RSAParameters PublicKey { get; set; }
View TCPAnalogReadme.md

View this file on GIST

TCPAnalog

How to run:

  • You need to run "networkLayer", using defined arguments:
    python networkLayer.py port maxNoPackets delay probDrop probMangle
    
You can’t perform that action at this time.