Skip to content

Instantly share code, notes, and snippets.

Avatar

Nikhil Raghavendra starhopp3r

View GitHub Profile
View cringetictactoe.c
#include <stdio.h>
// Blocks in map
char blk_1 = ' ';
char blk_2 = ' ';
char blk_3 = ' ';
char blk_4 = ' ';
char blk_5 = ' ';
char blk_6 = ' ';
char blk_7 = ' ';
View falcon.py
import gym
import rocket_lander_gym
from stable_baselines import PPO2
env = gym.make('RocketLander-v0')
# Monitor the run
env = gym.wrappers.Monitor(env, "./video", force=True)
# Load the saved model
model = PPO2.load("ppo2-falcon.zip", env=None)
# Run the trained agent
View osprog.cpp
// C++ Program to compute the area of a circle
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
// Variables to hold the radius and area
float radius, area;
@starhopp3r
starhopp3r / linkers_101.md
Created Nov 18, 2018 — forked from jvns/linkers_101.md
How to understand what's in a binary, with code!
View linkers_101.md

Step 0: A program, and prerequisites

We're going to be dealing with a "Hello, world!" program. Just one. There's going to be a bunch of fruit for discussion here. I'm going to be assuming you're on Linux, because we're gonna be talking about ELF and Macs use Mach-O and I don't know anything about Mach-O.

#include <stdio.h>

char *penguin = "Penguin";
char array[5] = {'a', 'b', 'c', 'd', 'e'};
@starhopp3r
starhopp3r / 00-dragndrop.swift
Created Nov 10, 2018 — forked from erica/00-dragndrop.swift
Building an OSX Drag and Drop Playground: Throw the dragndrop.swift into shared Sources and then test out the examples in individual playgrounds. Make sure the assistant is open and set to the timeline. I prefer vertical assistant stacking for this.
View 00-dragndrop.swift
import Cocoa
// Support Foundation calls on String
public extension String { public var ns: NSString {return self as NSString} }
/// Custom Labeled Playground-Based Drag-and-Drop window
public class DropView: NSTextField {
// Default action handler
public var handler: ([String]) -> Void = { paths in Swift.print(paths) }
View ledblinkamt.c
#include <xc.h>
#include "amt.h"
#include <stdio.h>
#pragma config XINST = OFF
#pragma config FOSC = HS
#pragma config WDT = OFF
void interrupt HighIsr(void) // High priority interrupt
{
View espmqtt.ino
//
// esp8266-mqtt-client.ino
// Beverly
//
// Created by Nikhil Raghavendra on 25/6/18.
// Copyright © 2018 Nikhil Raghavendra. All rights reserved.
//
#include <Arduino.h>
#include <Stream.h>
View gist:b18d63f4474bc65f2728128532a3d497
#!/bin/bash
#PBS -q normal
#PBS -l select=1:ncpus=1:mem=100M
#PBS -l walltime=00:10:00
#PBS -P 21170158
cd ${PBS_O_WORKDIR}
module load composerxe/2018.0.128
./helloworld
View graph_viz_windturbine.py
import pandas as pd
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
# Read cols
cols = cols = [1, 2, 3, 4, 7, 10]
# Training data
training_file = "training_data.csv"
View pyhelpex.py
# Numbers between 1534 and 2435 that are divisible by 7
[print(i) for i in range(1534, 2436) if i % 7 == 0]
# Numbers between 1534 and 2435 that are divisible by 7 OR 8
[print(i) for i in range(1534, 2436) if i % 7 == 0 or i % 8 == 0]
# Numbers between 1534 and 2435 that are divisible by 7 AND 8
[print(i) for i in range(1534, 2436) if i % 7 == 0 and i % 8 == 0]
# Last question with user input