Skip to content

Instantly share code, notes, and snippets.

View st0le's full-sized avatar
💭
nohello

Gaurav Kamath st0le

💭
nohello
View GitHub Profile
1. eight of clubs
2. two of clubs
3. four of spades
4. king of clubs
5. six of hearts
6. eight of diamonds
7. seven of hearts
8. five of diamonds
9. three of hearts
10. ten of hearts
#!/bin/sh
branch="$(git rev-parse --abbrev-ref HEAD)"
if [ "$branch" = "master" ]; then
echo "You can't commit directly to master branch"
exit 1
fi
@st0le
st0le / gist:c6964eb3efdfa043e1df325acb34fa6b
Created July 11, 2022 19:27
Build Rust projects without installing rust. (use a docker container)
FROM rust:latest
RUN apt update && apt upgrade -y
RUN apt install -y g++-mingw-w64-x86-64
RUN rustup target add x86_64-pc-windows-gnu
RUN rustup toolchain install stable-x86_64-pc-windows-gnu
WORKDIR /app
using System;
using System.Net;
using System.Net.NetworkInformation;
class Program
{
static void Main(string[] args)
{
foreach ( NetworkInterface netif in NetworkInterface.GetAllNetworkInterfaces() )
{
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <arpa/inet.h>
int main(int argc, char **argv)
{
if (argc < 2)
def is_match(text, pattern):
assert text != None
assert pattern != None
assert isinstance(text, str)
assert isinstance(pattern, str)
T, P = len(text), len(pattern)
def _is_match(ti, pi):
if pi == P:
@st0le
st0le / proto.py
Last active September 10, 2021 21:12
from sys import argv
print(len(argv))
print(argv)
@st0le
st0le / git-complete.ps1
Last active February 11, 2021 06:47
Lightweight git autocompletion.
# Basic Autocompleter for git
# Covers most usecases
Register-ArgumentCompleter -CommandName "git" -Native -ScriptBlock {
param($wordToComplete, $commandAst, $cursorPosition)
$cmd = $commandAst.ToString() -split " "
# order is based on "popularity"
$supportedCommands = @("checkout", "add", "commit", "branch", "status", "pull", "push", "merge", "log", "stash")
$comps = @()
@st0le
st0le / killall.ps1
Created May 20, 2020 18:33 — forked from ReubenBond/killall.ps1
killall cmd for PowerShell with completion
# In a PS terminal, type "code $profile" and put this in there
function killall {
param(
[ArgumentCompleter(
{
param($cmd, $param, $values)
get-process |
? { $_.Name.StartsWith($values, [StringComparison]::OrdinalIgnoreCase) } |
Sort -Unique Name |
@st0le
st0le / PlaysTvDownloader.ps1
Last active January 5, 2020 09:01
Downloads all public videos of a user
# Copy and paste this in a Powershell window. Enter the userId at the prompt. Follow instruction below to get your userId
# download all PlaysTv videos of a user
# To find the user id, navigate to the your profile while logged in (IMPORTANT!)
# View source of the page, In the <html> tag there's data-conf attribute.
# The json in there will have the user id under [login_user.id]
function Safe-Title {
param (
$Description,
$EpochMilliseconds