Skip to content

Instantly share code, notes, and snippets.

View gauravssnl's full-sized avatar
😸
use code::latest ;

GAURAV gauravssnl

😸
use code::latest ;
View GitHub Profile
type Event:
wait()
set()
type Link:
get(ptr: Ptr):
if LOAD(ptr, Acquire) |value|:
return value
e = Event{}
@gauravssnl
gauravssnl / LICENSE
Created February 28, 2023 14:40 — forked from rithvikvibhu/LICENSE
Get tokens for Google Home Foyer API
MIT License
Copyright (c) 2020 Rithvik Vibhu
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@gauravssnl
gauravssnl / rainbow.xml
Created January 25, 2023 17:09 — forked from nickbutcher/rainbow.xml
Demonstrating using VectorDrawable gradients to create a rainbow effect. See https://twitter.com/crafty/status/1011922414983352320
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2018 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the License for the specific language governing permissions and limitations under
the License.
@gauravssnl
gauravssnl / tictactoe.rs
Created January 14, 2023 11:47 — forked from paulshen/tictactoe.rs
egui tictactoe
use super::hyperlink::Hyperlink;
use eframe::{egui, epi};
use egui::{pos2, vec2, Color32, Pos2, Rect, Stroke, Widget};
use rand::seq::SliceRandom;
#[derive(Copy, Clone, Debug, PartialEq)]
enum Player {
User,
Computer,
}
@gauravssnl
gauravssnl / proxy.rs
Created January 11, 2023 16:52 — forked from fragsalat/proxy.rs
A simple and lightweight multi threaded TCP proxy written in Rust language. Not using any 3rd-party libraries but just standard libraries.
use std::net::{TcpListener, SocketAddr, TcpStream, Shutdown, SocketAddrV4, Ipv4Addr};
use std::str::FromStr;
use std::thread::{spawn, JoinHandle};
use std::io::{BufReader, BufWriter, Read, Write};
fn pipe(incoming: &mut TcpStream, outgoing: &mut TcpStream) -> Result<(), String> {
let mut buffer = [0; 1024];
loop {
match incoming.read(&mut buffer) {
Ok(bytes_read) => {
@gauravssnl
gauravssnl / hello-world.rs
Created January 8, 2023 11:36 — forked from badboy/hello-world.rs
Poor dev's Rust Compiler
fn main() {
println!("Hello World!");
}
@gauravssnl
gauravssnl / eprintdl.py
Created January 5, 2023 15:04 — forked from cronokirby/eprintdl.py
Script to download papers from eprint to pdf and markdown
from bs4 import BeautifulSoup
from dataclasses import dataclass
import os
from typing import List
import re
import requests
import sys
HEADERS = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36"
@gauravssnl
gauravssnl / main.rs
Created January 3, 2023 07:13 — forked from carstein/main.rs
Example code in Rust using fork and ptrace
use nix::sys::ptrace;
use nix::sys::signal::Signal;
use nix::sys::wait::{WaitStatus, wait};
use nix::unistd::{fork, ForkResult, Pid};
use std::collections::HashMap;
use std::ffi::c_void;
use std::os::unix::process::CommandExt;
use std::process::{Command, exit};
@gauravssnl
gauravssnl / unblock-domain.md
Created January 1, 2023 17:37 — forked from grovesNL/unblock-domain.md
Unblock domains from security filters

What is this?

When you register a new domain and start hosting content there, people might not be able to view it if they're behind some kind of security software or hardware that filters by domain (e.g. web/content/DNS filters). This is because the domain is new and hasn't been categorized by the security filter, and filters commonly don't allow traffic to uncategorized domains.

Usually people can contact their security provider to request the domain to be unblocked, but:

  • this process can take a few days or longer
  • sometimes this has to be handled by IT internally and might not be escalated to the provider
    • because of this, sometimes the domain will just be unblocked for a set of people (e.g. everyone at a company) and other companies have to repeat this
  • depending on how the filtering is implemented (e.g. how requests/responses are intercepted), websites might just appear broken instead of getting an explicit message about the website being blocked
  • usually this approach is reactionary, because
public static void main(String[] argv) throws InterruptedException {
Executors.newVirtualThreadPerTaskExecutor().
execute(() -> {
System.out.print("StringList: " + stringList);
});
stringList = List.of("ZZ", "XX", "LL", "DDD");
}