Skip to content

Instantly share code, notes, and snippets.

View avinayak's full-sized avatar

Atul Vinayak avinayak

  • Hiive
  • Vancouver, BC
  • 08:09 (UTC -07:00)
View GitHub Profile

1. pg. xxi: Care About Your Craft

Why spend your life developing software unless you care about doing it well?

2. pg. xxi: Think! About Your Work

Turn off the autopilot and take control. Constantly critique and appraise your work.

3. pg. 2: You Have Agency

@avinayak
avinayak / gist:b79991439ddc5d86b8f669e0e1e8082e
Created February 5, 2021 07:15
CMakeList.txt for SDL2 Projects in CLion
cmake_minimum_required(VERSION 3.17)
project(Pong)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
add_executable(Pong main.cpp pong.cpp pong.h)
import urllib.request
import urllib.parse
import json
import random
import tweepy
que = ['why', 'how', 'why', 'how', 'why', 'how', 'why', 'how',
'what', 'who', 'can', 'is', 'will', 'could', 'would']
def auto_query(que, word):
@avinayak
avinayak / recording p5js
Last active September 23, 2020 10:03
recording p5js skecthes in editor.p5js.org
### Add the snippet below in sketch.js
### optional: convert to mp4 using ffmpeg -fflags +genpts -i input.webm -r 24 out.mp4
function record(){chunks.length=0;let e=document.querySelector("#defaultCanvas0").captureStream(300),t=new MediaRecorder(e);t.ondataavailable=(e=>{e.data.size&&chunks.push(e.data)}),t.onstop=exportVideo,setTimeout(()=>{t.stop()},1e4),t.start()}function exportVideo(e){var t=new Blob(chunks),o=document.createElement("video");o.id="recorded",o.controls=!0,o.src=URL.createObjectURL(t),document.body.appendChild(o),o.play()}chunks=[],record();
AccelerometerManager accel;
float ax, ay, az;
void setup() {
accel = new AccelerometerManager(this);
orientation(PORTRAIT);
background (0);
fill(255);
flakes = new flake [N];
for(int i=0;i<N;i++)
defmodule Solution do
def main do
String.split(IO.read(:stdio, :all), [" ", "\n"])
|> Enum.with_index
|> Enum.filter(fn({_,i}) -> rem(i,2) ==1 end)
|> Enum.map(fn({x,_})->x end)
|> Enum.join("\n")
|> IO.puts
end
//go to swiggy.com
//log in
//press F12 on home page
//paste the script given below in console and press enter
//all_orders object will be populated with all your swiggy order data
all_orders=[]
recfetch = (oid)=>{
fetch('https://www.swiggy.com/dapi/order/all?order_id='+oid)
def binsearch(a,q):
l = mid = 0
r = len(a) -1
while l<=r:
mid = (l+r)//2
if a[mid] == q:
return mid
elif a[mid]< q:
l = mid +1
elif a[mid]> q:
<Response>
<Say voice="alice">Welcome to Thybolt. Welcome to Thybolt. Welcome to Thybolt. Welcome to Thybolt. Welcome to Thybolt. Welcome to Thybolt. </Say>
<Play>http://demo.twilio.com/docs/classic.mp3</Play>
</Response>
@avinayak
avinayak / Installing transmission & plex in RPi for NTFS drives
Last active June 1, 2018 13:09
Installing transmission & plex in RPi for NTFS drives
install ntfs-3g from sudo apt-get install
install transmission-daemon
add next line to end of ~/.bashrc
sudo mount -t ntfs-3g -o uid=pi,gid=debian-transmission,umask=007 /dev/sda1 /mnt/d1
stop transmission daemon
sudo nano /etc/transmission-daemon/settings.json # set all folders an stuff
sudo usermod -a -G debian-transmission pi
sudo nano /etc/init.d/transmission-daemon #change USER=pi