Skip to content

Instantly share code, notes, and snippets.

View sumeet's full-sized avatar

Sumeet Agarwal sumeet

  • San Francisco, CA
View GitHub Profile
@3v1n0
3v1n0 / xrandr-scale.sh
Last active March 25, 2019 20:36
Xrandr Scaling script, with auto panning when scaling down
#!/bin/bash
export LANG=C
output=$1;
scale=$2;
if [ -n "$output" ] && ! (xrandr --listmonitors | grep -qw "$output"); then
echo "Invalid output: '$output'";
exit 1;
// Suppose you have a variable named `future` which implements the `Future` trait.
let future: impl Future = ...;
// This gist demonstrates how to run the future until completion using the `stdweb` crate.
// The various imports.
extern crate futures;
extern crate stdweb;
@egmontkob
egmontkob / Hyperlinks_in_Terminal_Emulators.md
Last active May 14, 2025 19:31
Hyperlinks in Terminal Emulators
@harold-b
harold-b / dear imgui, selectable popup example
Created August 6, 2016 18:39
A functional selectable pseudo-popup window example using dear imgui, for use with autocomplete or input history.
const int ENTRY_COUNT = 10;
const char* ENTRIES[ENTRY_COUNT] =
{
"Entry 0",
"Entry 1",
"Entry 2",
"Entry 3",
"Entry 4",
"Entry 5",
@tikolakin
tikolakin / fish_alias.md
Last active February 17, 2025 10:33
Create alias in Fish shell and save this as a permanent function

Directly from CLI

alias x='exit'
funcsave x

or create a file in

~/.config/fish/functions 

with name

@hunterbridges
hunterbridges / twitch_irc.md
Last active April 21, 2025 11:03
How to connect to Twitch with an IRC client (As of Oct 2015)

HOWTO

Connect to Twitch.tv chat with an IRC client

  1. Visit this website and get an OAuth Token for your Twitch account.
  2. Add a server to your IRC client with this configuration, using your OAuth Token as the server password. Make sure it is not using SSL.
{
  address = "irc.twitch.tv";
chatnet = "Twitch";
@joshuawscott
joshuawscott / redis_slowlog.rb
Last active August 6, 2017 10:01
Get Redis Slowlog Entries and parse them
# [[87283, 1442412746, 18052, ["hincrby", "191320:2015-09-16", "2015-09-16T13:39:00.000Z", "1"]], [87282, 1442411252, 22037, ["setex", "sifi_session:da34d588e031730b84a0462538022c60", "604800", "\u0004\b{\u0000"]], [87281, 1442410521, 81575, ["scan", "0", "MATCH", "CampaignStatistic:*", "COUNT", "1000"]], [87280, 1442409284, 12309, ["hincrby", "167569:2015-09-16", "2015-09-16T12:57:00.000Z", "1"]], [87279, 1442409279, 11073, ["hincrby", "163562:2015-09-16", "2015-09-16T12:55:00.000Z", "1"]], [87278, 1442409206, 14440, ["hincrby", "163558:2015-09-16", "2015-09-16T12:40:00.000Z", "1"]], [87277, 1442409198, 14750, ["hincrby", "187840:2015-09-16", "2015-09-16T12:34:00.000Z", "1"]], [87276, 1442409180, 11376, ["hincrby", "127478:2015-09-16", "2015-09-16T12:07:00.000Z", "1"]], [87275, 1442405559, 18445, ["hincrby", "182934:2015-09-16", "2015-09-16T11:13:00.000Z", "1"]], [87274, 1442405558, 57467, ["hincrby", "17342:2015-09-16", "2015-09-16T11:03:00.000Z", "1"]]]
require 'redis'
class Entry
attr_reader :log_numbe
@mwender
mwender / impbcopy.m
Last active March 9, 2025 19:38
Command line copy an image file to the clipboard in Mac OS X. See first comment for install instructions.
#import <Foundation/Foundation.h>
#import <Cocoa/Cocoa.h>
#import <unistd.h>
BOOL copy_to_clipboard(NSString *path)
{
// http://stackoverflow.com/questions/2681630/how-to-read-png-image-to-nsimage
NSImage * image;
if([path isEqualToString:@"-"])
{
// http://caiustheory.com/read-standard-input-using-objective-c
@akesterson
akesterson / gist:5eb9b223db4cfa3d22d4
Created January 25, 2015 02:26
8086 bootloader / kernel "load from disk and jump to kernel" problem
##### First we build from scratch ...
#######################################
akesterson@akesterson-pc:~/source/upstream/git/akesterson/piquant$ make clean all
rm -f boot.bin asm/*o src/*o
bcc -ansi -3 -c -o src/kernel.o src/kernel.c
ld86 -T0x1000 -M -o kernel.bin src/kernel.o
kernel _printString 0 0000101b R
kernel _main 0 00001049 R
kernel _printChar 0 00001000 R