Skip to content

Instantly share code, notes, and snippets.

View sonus's full-sized avatar
☸️
Focusing

Sonus Sundar sonus

☸️
Focusing
View GitHub Profile
@sonus
sonus / doa.php
Created April 17, 2024 09:16
Depend on Abstractions, not Concretions (Framework)
<?php
abstract class Player {
public abstract function play();
}
class Human extends Player {
public function play() {
echo "Human player makes a move.\n";
}
@sonus
sonus / IntToRoman.php
Created April 4, 2022 05:07
Int To Roman
<?php
class Solution {
private $romans = [
'M' => 1000,
'CM'=> 900,
'D'=>500,
'CD'=>400,
'C'=>100,
'XC'=>90,
'L'=>50,
@sonus
sonus / RomanToInt.php
Created April 4, 2022 04:38
Roman To Int in PHP
<?php
class Solution {
private $romans = [
'I' => 1,
'V' => 5,
'X' => 10,
'L' => 50,
'C' => 100,
'D' => 500,
'M' => 1000
@sonus
sonus / rasp.py
Created October 24, 2020 04:46
rasp
import RPi.GPIO as GPIO
import time
servoPIN = 17
GPIO.setmode(GPIO.BCM)
GPIO.setup(servoPIN, GPIO.OUT)
p = GPIO.PWM(servoPIN, 50) # GPIO 17 for PWM with 50Hz
p.start(2.5) # Initialization
try:
@sonus
sonus / ww
Created June 24, 2020 10:49
Bbau
sdfsdsd
@sonus
sonus / varnishlog-examples.sh
Created November 25, 2019 11:03 — forked from cupracer/varnishlog-examples.sh
varnishlog examples (version 4.x)
# filter by request host header
varnishlog -q 'ReqHeader ~ "Host: example.com"'
# filter by request url
varnishlog -q 'ReqURL ~ "^/some/path/"'
# filter by client ip (behind reverse proxy)
varnishlog -q 'ReqHeader ~ "X-Real-IP: .*123.123.123.123"'
# filter by request host header and show request url and referrer header
@sonus
sonus / varnishlog-examples.sh
Created November 25, 2019 11:03 — forked from cupracer/varnishlog-examples.sh
varnishlog examples (version 4.x)
# filter by request host header
varnishlog -q 'ReqHeader ~ "Host: example.com"'
# filter by request url
varnishlog -q 'ReqURL ~ "^/some/path/"'
# filter by client ip (behind reverse proxy)
varnishlog -q 'ReqHeader ~ "X-Real-IP: .*123.123.123.123"'
# filter by request host header and show request url and referrer header
@sonus
sonus / rickandmorty.js
Created November 20, 2019 03:35
rickandmorty.402.js
var r_text = new Array ();
r_text[0] = "Nobody exists on purpose, nobody belongs anywhere, everybody's gonna die. Come watch TV.";
r_text[1] = "Wubba lubba dub dub!";
r_text[2] = "To live is to risk it all, otherwise you're just an inert chunk of randomly assembled molecules drifting wherever the universe blows you.";
r_text[3] = "Well, all is forgiven, because right now, I’ve got an erection the size of an East Coast lighthouse, and I’m coming home to share it with my beautiful wife.";
r_text[4] = "All I have are pictures are of me and my friends from school. What? What teenage girl has pictures of her family? It's not like we're Mormon or dying";
r_text[5] = "Get off the high road, Summer! We all got pinkeye because you won't stop texting on the toilet.";
r_text[6] = "No, no, I haven't seen that. I mean, why would a Pop-Tart want to live inside a toaster, Rick? I mean, th-that would be like the scariest place for them to live. Y'know what I mean?";
r_text[7] = "And this is why you don't invite a Floopy Doop
@sonus
sonus / git-cheat-sheet.md
Created July 13, 2018 06:28
Git Cheat Sheet

To set your identity:

git config --global user.name "John Doe"

git config --global user.email [email protected]

To set your editor:

git config --global core.editor emacs

http://charts3.equitystory/teaser/pumanew/English