Skip to content

Instantly share code, notes, and snippets.

@tcantenot
tcantenot / PerfectHash.cpp
Created Jan 24, 2021 — forked from dwilliamson/PerfectHash.cpp
Trivial perfect hash generator that uses only a single array for runtime lookup with next to no ALU. Very good for small table sizes (e.g. < 128). Very bad for larger table sizes. This has been quickly "STL-ified" to remove use of my own containers.
View PerfectHash.cpp
uint32_t NextPow2(uint32_t v)
{
v--;
v |= (v >> 1);
v |= (v >> 2);
v |= (v >> 4);
v |= (v >> 8);
v |= (v >> 16);
v++;
@richardleslie25
richardleslie25 / PY0101EN-2-4-Sets.ipynb
Created Jan 24, 2021
Created on Skills Network Labs
View PY0101EN-2-4-Sets.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nurcanozturk
nurcanozturk / PY0101EN-3-3-Functions.ipynb
Created Jan 24, 2021
Created on Skills Network Labs
View PY0101EN-3-3-Functions.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@0xdw
0xdw / GameManager.cs
Created Jan 24, 2021
Unity - Add a description to a custom script
View GameManager.cs
using UnityEngine;
public class GameManager : MonoBehaviour { }
@dpy-manager-bot
dpy-manager-bot / codebeautify.txt
Last active Jan 24, 2021
A file by STron#8688 in the discord.py guild
View codebeautify.txt
{
"response_code": 0,
"results": [
{
"category": "General Knowledge",
"type": "multiple",
"difficulty": "easy",
"question": "What is the first book of the Old Testament?",
"correct_answer": "Genesis",
"incorrect_answers": [
View setup.py
n_data_points = len(inputs)
train = int(n_data_points * 0.8)
validate = (n_data_points - train) // 2
test = n_data_points - train - validate
# train the model over the specified number of epochs
for i in range(epochs):
err = 0
View MovieTestApp.kt
class MovieTestApp : MovieDbApp() {
override fun getBaseUrl() = "http://localhost:8080"
}
@CTurt
CTurt / Bookmark
Created Jan 24, 2021
Bookmark specific location within page without any id attributes; only works for pages that allow iframe
View Bookmark
data:text/html,<html><body style="margin:0; padding:0;"><iframe id='i' src='http://forecast.weather.gov/MapClick.php?CityName=Las+Vegas&state=NV&site=VEF&textField1=36.175&textField2=-115.136&e=0' width=100% frameborder=0 marginheight=0 marginwidth=0 scrolling=no style="height: calc(100vh + 170px + 200px);"></iframe></body><script>window.scrollTo(0, 170);window.onscroll = function(ev) {if ((window.innerHeight + window.scrollY) >= document.body.offsetHeight - 200) {document.getElementById('i').style.height = window.innerHeight + window.scrollY + 200;}};</script></html>