Skip to content

Instantly share code, notes, and snippets.

@realvjy
realvjy / ChoasLinesShader.metal
Last active May 8, 2024 14:23
Choas Lines - Metal Shader
// Lines
float hash( float n ) {
return fract(sin(n)*753.5453123);
}
// Slight modification of iq's noise function.
float noise(vector_float2 x )
{
vector_float2 p = floor(x);
vector_float2 f = fract(x);
@ingo-m
ingo-m / debian_install_nvidia_docker.md
Last active May 8, 2024 14:21
Install nvidia docker for GPU-enabled tensorflow on Debian 10

Install nvidia docker for GPU-enabled tensorflow on Debian 10

Overview

  1. Install proprietary nvidia driver
  2. Install nvidia-container-toolkit, containing CUDA (?) (via apt-get)
  3. Install tensorflow docker container

(1) Install proprietary nvidia driver

@reborg
reborg / rich-already-answered-that.md
Last active May 8, 2024 14:20
A curated collection of answers that Rich gave throughout the history of Clojure

Rich Already Answered That!

A list of commonly asked questions, design decisions, reasons why Clojure is the way it is as they were answered directly by Rich (even when from many years ago, those answers are pretty much valid today!). Feel free to point friends and colleagues here next time they ask (again). Answers are pasted verbatim (I've made small adjustments for readibility, but never changed a sentence) from mailing lists, articles, chats.

How to use:

  • The link in the table of content jumps at the copy of the answer on this page.
  • The link on the answer itself points back at the original post.

Table of Content

@skippednote
skippednote / setup-tor.md
Last active May 8, 2024 14:20
Setup Tor on macOS

Setup One: Buy a Mac if you don't have one.

Setup Two: Install Homebrew

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Setup Three:

@uris77
uris77 / repo_pattern.py
Last active May 8, 2024 14:20
Example of Repository Pattern with SQLAlchemy
# This is a very crud example of using the Repository Pattern with SQLAlchemy. It allows me to completely ignore interactions with
# the database. This is only pulled in whenever I require to persist or retrieve an object from the database. The domain/business
# logic is entirely separated from persistence and I can have true unit tests for those.
# The tests for persistence are then limited to very specific cases of persistence and retrieving instances, and I can do those
# independent of the business logic. They also tend to be less tests since I only need to test them once.
@LaurenceRawlings
LaurenceRawlings / Laravel Sail Setup.md
Last active May 8, 2024 14:19
Setup Laravel Sail from source control

Laravel Sail Setup

This is a simple script along with some useful information to help when setting up a Laravel Sail project that was cloned from source control. I made this because I could not find anywhere that explained how to do this and kept running into problems. The main issue was a problem with database authentication. It turns out that when the Docker volume is created for the database for the first time the password that is in the .env file is used, which I usually created after starting Sail for the first time. Another issue was not having access to the Sail binary to start the containers. This is solved by the script by installing the composer dependencies with a disposable container. If you follow the steps below in order you should not run into any issues. Feel free to leave a comment on this Gist if it could be improved.

How to use

@hcwhan
hcwhan / gist:28bc1b2cd26446b970864db02098ea90
Created December 8, 2017 03:53
联通WO-27s HG8321R光猫改桥接

#联通WO-27s HG8321R光猫改桥接

  1. 访问http://192.168.1.1/cu.html
  2. 登陆用户名CUAdmin,密码CUAdmin
  3. 进入基本设置-> 上行线路配置,记下 2_Internet_xxx 链接中的 Vlan id,我这里是10,删除 2_Internet_xxx 链接,重启光猫。
  4. 重复步骤1和2,以管理员登录,在基本设置-> 上行线路配置中新增 Wan 链接,模式选择桥接,选中Vlan,将 Vlan id 设置成之前记录下的 Vlan id,服务模式选 Internet
  5. 选择端口1进行绑定,之后用路由器接在对应端口上,使用帐号密码进行拨号就OK了。
import sys
from awsglue.transforms import *
from awsglue.utils import getResolvedOptions
from pyspark.context import SparkContext
from awsglue.context import GlueContext
from awsglue.job import Job
from pyspark.sql.functions import *
from awsglue.dynamicframe import DynamicFrame
@hjbotha
hjbotha / free_ports.sh
Last active May 8, 2024 14:15
Free ports 80 and 443 on Synology NAS
#! /bin/bash
# NEWLY ADDED BACKUP FUNCTIONALITY IS NOT FULLY TESTED YET, USE WITH CARE, ESPECIALLY DELETION
# Developed for DSM 6 - 7.0.1. Not tested on other versions.
# Steps to install
# Save this script in one of your shares
# Edit it according to your requirements
# Backup /usr/syno/share/nginx/ as follows:
# # cd /usr/syno/share/
# # tar cvf ~/nginx.tar nginx
@wojteklu
wojteklu / clean_code.md
Last active May 8, 2024 14:15
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules