Skip to content

Instantly share code, notes, and snippets.

@doorbash
doorbash / sms_door_rc.ino
Created November 23, 2019 21:16
arduino uno + 433 mhz transmitter + air200
#define MESSAGE_TOTAL_LENGTH 301
#define BIT_PERIOD 350
#define DATA_PIN 4
#include <SoftwareSerial.h>
const char *STR_REC_UNREAD = "\"REC UNREAD\"";
const char *STR_PHONE_NUMBER = "\"+98XXXXXXXXXX\"";
int data[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, 0};
int size = sizeof(data) / sizeof(int);
#include <iostream>
#include <thread>
#include <functional>
int main(int argc, char *argv[]) {
int x = 1;
std::cout << "[1] x is " << x << std::endl;
package main
import (
"fmt"
"log"
"net/http"
)
func main() {
http.HandleFunc("/", func(rw http.ResponseWriter, r *http.Request) {
import io.undertow.Undertow;
import io.undertow.server.HttpHandler;
import io.undertow.server.HttpServerExchange;
public class HelloWorldServer {
public static void main(final String[] args) {
Undertow server = Undertow.builder()
.addHttpListener(8081, "localhost")
.setHandler(new HttpHandler() {
import com.mongodb.MongoClient;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoCursor;
import com.mongodb.client.MongoDatabase;
import org.bson.Document;
import org.json.JSONArray;
import org.json.JSONObject;
import java.io.*;
import java.net.ServerSocket;
@doorbash
doorbash / user.go
Created September 10, 2019 06:57
github.com/doorbash/my-api/model/user.go
package model
type User struct {
Id string `json:"id"`
Name string `json:"name"`
Coins int32 `json:"coins"`
Emojis []int32 `json:"emojis"`
CreatedAt int64 `json:"createdAt"`
}
@doorbash
doorbash / user.go
Last active September 10, 2019 07:27
github.com/doorbash/my-api/routes/user.go
package routes
import (
"context"
"encoding/json"
"fmt"
"github.com/doorbash/my-api/model"
"github.com/gorilla/mux"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/bson/primitive"
@doorbash
doorbash / main.go
Last active September 10, 2019 07:28
github.com/doorbash/my-api/main.go
package main
import (
"context"
"github.com/doorbash/my-api/routes"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
"log"
"net/http"
"time"
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.math.Matrix4;
import java.lang.reflect.Field;
/**
* Created by Milad Doorbash on 8/31/2019.
*/
public class DebugSpriteBatch extends SpriteBatch {
# 1. pip3 install telethon
# 2. Go to https://my.telegram.org/ and get api_id, api_hash
from telethon import TelegramClient, events, sync
import logging
logging.basicConfig(format='[%(levelname) 5s/%(asctime)s] %(name)s: %(message)s',level=logging.WARNING)
api_id = 12345
api_hash = 'PUT-YOUR-API-HASH-HERE'