Skip to content

Instantly share code, notes, and snippets.

View 5pecia1's full-sized avatar
😀
Rustaceans

sol 5pecia1

😀
Rustaceans
View GitHub Profile
@gauchy
gauchy / notion2Habitica.py
Last active June 27, 2024 10:12
Notion to Habitica Sync tool
import requests, json
#Notion's token and databaseId
token = 'XXX'
databaseId = 'XXX'
#Notion's headers
headers = {
"Authorization": "Bearer " + token,
"Content-Type": "application/json",
@qdm12
qdm12 / README.md
Last active July 3, 2024 06:23
Wireguard and iptables restrictions for multiple users

Wireguard and iptables restrictions for multiple users

If you don't know what Wireguard is, well, you should. It's fast, easy to setup and highly configurable. We will configure Wireguard for multiple users with various restrictions using iptables.

Assumptions

This should fit most setups (not mine though 😉)

@segfault87
segfault87 / dodo_fighter_agent.py
Last active August 19, 2018 10:58
도도 파이터(https://pycon-2018-dodo-fighter.spoqa.com) 에이전트 예제 코드
import json
import sys
# 도도 파이터에 참가하기 위해서는 에이전트를 만들어서 제출해 주셔야 합니다.
# 에이전트는 사용자가 작성하는 인공지능 코드로서, 주어지는 현재 게임 상태를 바탕으로
# 어떤 액션을 취할지를 결정하는 역할을 합니다.
#
# 액션 설명
# - idle - 아무것도 하지 않습니다.
# - forward - 앞으로 움직입니다. 상대가 바로 앞에 있을 경우 더 움직이지 않습니다.
@tanaikech
tanaikech / submit.md
Last active April 15, 2021 01:28
Copying Values from JSON to Struct using reflect Package for Golang

Copying Values from JSON to Struct using reflect Package

This is a sample script for copying values from JSON to a struct using reflect package.

Script :

package main

import (
	"encoding/json"
	"fmt"
@styblope
styblope / docker-api-port.md
Last active June 20, 2024 07:07
Enable TCP port 2375 for external connection to Docker

Enable TCP port 2375 for external connection to Docker

See this issue.
Docker best practise to Control and configure Docker with systemd.

  1. Create daemon.json file in /etc/docker:

     {"hosts": ["tcp://0.0.0.0:2375", "unix:///var/run/docker.sock"]}
    
@BretFisher
BretFisher / docker-swarm-ports.md
Last active June 11, 2024 14:06
Docker Swarm Port Requirements, both Swarm Mode 1.12+ and Swarm Classic, plus AWS Security Group Style Tables

Docker Swarm Mode Ports

Starting with 1.12 in July 2016, Docker Swarm Mode is a built-in solution with built-in key/value store. Easier to get started, and fewer ports to configure.

Inbound Traffic for Swarm Management

  • TCP port 2377 for cluster management & raft sync communications
  • TCP and UDP port 7946 for "control plane" gossip discovery communication between all nodes
  • UDP port 4789 for "data plane" VXLAN overlay network traffic
  • IP Protocol 50 (ESP) if you plan on using overlay network with the encryption option

AWS Security Group Example

@sokcuri
sokcuri / ServerTime.js
Last active July 27, 2017 23:49
Calculate and Show ServerTime (Tested Chrome)
function e(){if(typeof clocks!='undefined')return;var sokcuri="Sokcuri ServerTime";var url="https://gist.github.com/";var div=document.createElement('div');div.id="clocks";div.style.position='fixed';div.style.width='100%';div.style.top='0';div.style.height='150';div.style.pointerEvents='none';div.style.backgroundColor='rgba(200, 200, 200, 0.4)';div.innerHTML='서버시간을 얻어오는 중..';div.style.zIndex='99999';div.style.fontSize='40px';if(document.getElementsByTagName('body').length){document.body.appendChild(div);}else{document.head.outerHTML+=div.outerHTML;} function leadingZeros(n,digits){var zero='';n=n.toString();if(n.length<digits){for(i=0;i<digits-n.length;i++)zero+='0';} return zero+n;} var sec;var curr;var curr_sys;var cont=true;var nget=0;function getsrvTime(){delay=0;if(nget>=200) {clocks.innerHTML="서버시간을 얻어오는데 실패했습니다";return 0;} if(window.XMLHttpRequest){var req=new XMLHttpRequest();req.open('HEAD',window.location.href.toString()+'?&_='+new Date().getTime(),true);req.setRequestHeader("Content-Type","text/htm
@karpathy
karpathy / min-char-rnn.py
Last active June 28, 2024 06:13
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)