Skip to content

Instantly share code, notes, and snippets.

View chris-gong's full-sized avatar
:shipit:
I'm back

Chris Gong chris-gong

:shipit:
I'm back
View GitHub Profile
@chris-gong
chris-gong / ws2812ledstrip.py
Last active July 2, 2022 10:53
Code for lighting up a WS2812 LED Strip
from rpi_ws281x import *
# LED strip configuration:
LED_COUNT = 300 # Number of LED pixels.
LED_PIN = 18 # GPIO pin connected to the pixels (18 uses PWM!).
#LED_PIN = 10 # GPIO pin connected to the pixels (10 uses SPI /dev/spidev0.0).
LED_FREQ_HZ = 800000 # LED signal frequency in hertz (usually 800khz)
LED_DMA = 10 # DMA channel to use for generating signal (try 10)
LED_BRIGHTNESS = 255 # Set to 0 for darkest and 255 for brightest
LED_INVERT = False # True to invert the signal (when using NPN transistor level shift)
@chris-gong
chris-gong / coinbase.py
Created May 15, 2019 00:20
Code for sending requests to the coinbase api and receiving price data as a json response.
import requests
import json
import time
while True :
response = requests.get("https://api.coinbase.com/v2/prices/BTC-USD/spot")
data = response.json()
currency = data["data"]["base"]
price = data["data"]["amount"]
print(f"Currency : {currency} Price: {price}")
@chris-gong
chris-gong / GameLiftTutorialGameMode.cpp
Created April 22, 2020 01:26
The GameLiftTutorialGameMode.cpp file after part 2 of the Flopperam UE4 GameLift tutorial series
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
#include "GameLiftTutorialGameMode.h"
#include "GameLiftTutorialCharacter.h"
#include "UObject/ConstructorHelpers.h"
AGameLiftTutorialGameMode::AGameLiftTutorialGameMode()
{
// set default pawn class to our Blueprinted character
static ConstructorHelpers::FClassFinder<APawn> PlayerPawnBPClass(TEXT("/Game/ThirdPersonCPP/Blueprints/ThirdPersonCharacter"));
@chris-gong
chris-gong / GameLiftTutorialGameMode.h
Created April 22, 2020 01:26
The GameLiftTutorialGameMode.h file after part 2 of the Flopperam UE4 GameLift tutorial series
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "GameLiftServerSDK.h"
#include "GameFramework/GameModeBase.h"
#include "GameLiftTutorialGameMode.generated.h"
USTRUCT()
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "gamelift:*",
"Resource": "*"
}
]
}
VC_redist.x64.exe /q
Engine\Extras\Redist\en-us\UE4PrereqSetup_x64.exe /q
{
"name": "aliens_vs_cowboys",
"ruleLanguageVersion": "1.0",
"playerAttributes": [{
"name": "skill",
"type": "number",
"default": 10
}],
"teams": [{
"name": "cowboys",
const AWS = require('aws-sdk');
const DynamoDb = new AWS.DynamoDB({region: 'us-east-1'});
const TypeToRank = {
MatchmakingSearching: '1',
PotentialMatchCreated: '2',
MatchmakingSucceeded: '3',
MatchmakingTimedOut: '4',
MatchmakingCancelled: '5',
MatchmakingFailed: '6'
};
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
using UnrealBuildTool;
public class GameLiftTutorial : ModuleRules
{
public GameLiftTutorial(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/GameModeBase.h"
#include "MainMenuGameMode.generated.h"
/**
*