Skip to content

Instantly share code, notes, and snippets.

View RudraNilBasu's full-sized avatar
💾
e83c5163316f89bfbde7d9ab23ca2e25604af290

Rudra Nil Basu RudraNilBasu

💾
e83c5163316f89bfbde7d9ab23ca2e25604af290
View GitHub Profile
@rygorous
rygorous / gist:c6831e60f5366569d2e9
Last active February 4, 2021 18:56
Please tell me more about your "zero-cost abstractions".
// Conjugate split-radix FFT inner loop
// Both of these compiled with VC++ 2012, 32-bit, "/O2 /fp:fast".
// NOTE: I also tried clang-cl and it seems to be primarily a VC++
// problem. (Which doesn't help me much.)
//
// NOTE 2: argh, did the Clang test wrong. It's still primarily a
// VC++ problem, but Clang has a notable slowdown too. Anyway, new
// results generated automatically from a simpler standalone test
// where I can toggle between versions using a single commandline
@bradwestfall
bradwestfall / gist:f5a010e96fb0c4d18556
Last active November 20, 2022 14:40
Pull Instagram Images via JavaScript
<div class="github-card" data-user="laumania"></div>
<script src="http://lab.lepture.com/github-cards/widget.js"></script>
#!/bin/env sh
lines=$(tput lines)
cols=$(tput cols)
awkscript='
{
letters="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*()"
lines=$1
@Na0ki
Na0ki / eject.py
Created June 1, 2014 13:08
multi platform eject command using python
# coding: UTF-8
import platform
import os
import ctypes
# windows
if platform.system() == 'Windows':
# need 'u' before "", if you are using UTF-8. if not you don't need to put it.
ctypes.windll.WINMM.mciSendStringW(u"set cdaudio door open", None, 0, None)
#ctypes.windll.WINMM.mciSendStringW(u"set cdaudio door closed", None, 0, None)
@makomweb
makomweb / pub_sub_cpp.cpp
Last active August 24, 2023 08:13
Fun with C++: implementing a pub/sub scenario using std::bind and other standard facilities. The approach is pretty similar to the well known .NET event mechanism.
#include <iostream>
#include <map>
#include <algorithm>
#include <functional>
#include <memory>
using namespace std;
class EventArgs {
public:
@Hamcha
Hamcha / SmoothFollow.cs
Created July 28, 2013 00:45
Stupid Unity scripts : "Smooth Follow" from Standard Assets
// Smooth Follow from Standard Assets
// Converted to C# because I fucking hate UnityScript and it's inexistant C# interoperability
// If you have C# code and you want to edit SmoothFollow's vars ingame, use this instead.
using UnityEngine;
using System.Collections;
public class SmoothFollow : MonoBehaviour {
// The target we are following
public Transform target;
@khakimov
khakimov / gist:3558086
Created August 31, 2012 19:49
Matrix Effect in you terminal
echo -e "\e[1;40m" ; clear ; while :; do echo $LINES $COLUMNS $(( $RANDOM % $COLUMNS)) $(( $RANDOM % 72 )) ;sleep 0.05; done|awk '{ letters="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*()"; c=$4; letter=substr(letters,c,1);a[$3]=0;for (x in a) {o=a[x];a[x]=a[x]+1; printf "\033[%s;%sH\033[2;32m%s",o,x,letter; printf "\033[%s;%sH\033[1;37m%s\033[0;0H",a[x],x,letter;if (a[x] >= $1) { a[x]=0; } }}'
@armornick
armornick / openicon.c
Created August 23, 2012 08:47
Draw an Image with SDL2
#include <stdio.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#define WIDTH 800
#define HEIGHT 600
#define IMG_PATH "exit.png"
int main (int argc, char *argv[]) {

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name: