Skip to content

Instantly share code, notes, and snippets.

View MarkMoretto's full-sized avatar
🐼
Typing something...

Mark Moretto MarkMoretto

🐼
Typing something...
View GitHub Profile
@reallytiredofclowns
reallytiredofclowns / discuitstats.py
Last active August 19, 2024 00:18
Discuit activity summary script
# to do: error checking/resumption code (can use pagination cursor of post to determine when script paused?)
# clean up repetition
# timing issue: if fetching by latest, someone can make a comment
# that puts a post out of the date limits before the looping
# has a chance to fetch the post
# do a second sweep after hitting the date limit?
# would have to store the script's start time and figure out
# when it halts due to hitting the lower date limit and
# reprocess comments according to that...
@candlerb
candlerb / go-project-layout.md
Last active October 1, 2024 08:33
Suggestions for go project layout

If someone asked me the question "what layout should I use for my Go code repository?", I'd start by asking back "what are you building: an executable, or a library?"

Single executable

Stage 1: single source file

Create a directory named however you want your final executable to be called (e.g. "mycommand"), change into that directory, and create the following files:

package main
import (
"math/rand"
"strconv"
"testing"
)
var res int64
@xquangdang
xquangdang / rn-with-wsl-wsa.md
Last active March 22, 2024 14:39
Develop React Native app with WSL and WSA

Develop React Native app with WSL and WSA

Requirement

  • Windows Subsystem for Linux 2 (WSL2)
  • Windows Subsystem for Android (WSA)
  • NodeJS install inside WSL2

Steps

WSA

@lizkes
lizkes / go-os-arch.md
Created January 10, 2021 17:05 — forked from asukakenji/0-go-os-arch.md
Go (Golang) GOOS and GOARCH

Go (Golang) GOOS and GOARCH

All of the following information is based on go version go1.14.7 darwin/amd64.

A list of valid GOOS values

(Bold = supported by go out of the box, ie. without the help of a C compiler, etc.)

  • aix
  • android
@JHethDev
JHethDev / Btn.svelte
Created April 16, 2020 21:32
Sapper localStorage Example
<script>
import { country } from '../stores/local-store.js;
export let location;
function setCountry(value) {
// We can use this here because _layout calls useLocalStorage for country.
// If you have multiple variables to store each will need to be called
// in the same way in the _layout file.
country.set(value);
}
@mildsunrise
mildsunrise / arithmetic.py
Last active December 10, 2023 23:47
Integer (and polynomial) modular arithmetic for Python!
"""
INTEGER MODULAR ARITHMETIC
These functions implement modular arithmetic-related functions (Z/nZ).
As an implied precondition, parameters are assumed to be integers unless otherwise noted.
This code is time-sensitive and thus NOT safe to use for online cryptography.
"""
from typing import Iterable, Tuple, NamedTuple
from functools import reduce
@whoisryosuke
whoisryosuke / useMousePosition.md
Created November 5, 2018 19:22
React Hooks - Track user mouse position - via: https://twitter.com/JoshWComeau

Hook

import { useState, useEffect } from "react";

const useMousePosition = () => {
  const [mousePosition, setMousePosition] = useState({ x: null, y: null });

  const updateMousePosition = ev => {
 setMousePosition({ x: ev.clientX, y: ev.clientY });
@machinaut
machinaut / Dockerfile
Created October 26, 2018 00:08
Demonstrating installing mujoco-py and gym[mujoco] on ubuntu 18.04
FROM ubuntu:18.04
# Install python and utils
RUN apt-get update && apt-get install -y python3-pip curl unzip \
libosmesa-dev libglew-dev patchelf libglfw3-dev
# Download mujoco
RUN curl https://www.roboti.us/download/mjpro150_linux.zip --output /tmp/mujoco.zip && \
mkdir -p /root/.mujoco && \
unzip /tmp/mujoco.zip -d /root/.mujoco && \
@miguelmota
miguelmota / server.go
Last active August 24, 2024 18:36
Golang TCP server example
package server
import (
"bufio"
"fmt"
"log"
"net"
)
// Server ...