This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def floodFill(img, sr, sc, new_value): | |
old_value = img[sr][sc][0] | |
queue = [(sr, sc)] | |
seen = set() | |
tot_rows = img.shape[0] | |
tot_cols = img.shape[1] | |
while queue: | |
nxt = [] | |
for x, y in queue: | |
if (img[x][y] == new_value): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="google_translate_element"></div> | |
<script type="text/javascript"> | |
function googleTranslateElementInit() { | |
new google.translate.TranslateElement({pageLanguage: 'en', layout: google.translate.TranslateElement.InlineLayout.SIMPLE}, 'google_translate_element'); | |
} | |
</script><script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<body> | |
<p id="text1">Test auf Deutsch!</p> | |
<script> | |
if (navigator.language != "de-DE" && navigator.language != "de" && window.location.hash != "#eng") | |
{ | |
window.location.href = "#eng"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections.Generic; | |
[RequireComponent(typeof(MeshRenderer))] | |
[RequireComponent(typeof(MeshFilter))] | |
public class GridMesh : MonoBehaviour | |
{ | |
public int GridSize; | |
void Awake() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
[ExecuteInEditMode] | |
public class GridSnapping : MonoBehaviour | |
{ | |
public GameObject target; | |
Vector3 gridPos; | |
public float gridSize = 10f; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//NOTE: This only works for Android | |
using (AndroidJavaClass cls = new AndroidJavaClass("java.util.Locale")) | |
{ | |
using (AndroidJavaObject locale = cls.CallStatic<AndroidJavaObject>("getDefault")) | |
{ | |
if (locale.Call<string>("getDisplayLanguage") == "हिन्दी") | |
{ | |
//HINDI | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import os | |
import time | |
def measure_temp(): | |
temp = os.popen("vcgencmd measure_temp").readline() | |
return (temp.replace("temp=","").replace("'C","")) | |
while True: | |
temp = measure_temp() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Requirements: | |
#youtube-dl | |
#omxplayer | |
#Move this file into /usr/local/bin and add execute permission (sudo chmod +x omxplayeryoutube.sh) | |
#Run it like this: ./omxplayeryoutube.sh https://www.youtube.com/watch?v=l4bDVq-nP-0 | |
omxplayer -o hdmi $(youtube-dl -g "$1") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
//something | |
} catch(e) { | |
window.location.href = | |
"http://stackoverflow.com/search?q=[js] + " | |
+ e.message; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Net; | |
using System.Net.Sockets; | |
using System.Text; | |
namespace UDP | |
{ | |
public class UDPSocket | |
{ | |
public Socket _socket; |