Skip to content

Instantly share code, notes, and snippets.

View aishraj's full-sized avatar

Aish aishraj

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aishraj
aishraj / notes_little_book_of_semaphores.md
Created January 22, 2023 18:31 — forked from jlerche/notes_little_book_of_semaphores.md
Notes on implementing synchronization techniques using semaphores, in rust, from The Little Book of Semaphores

Link to the book

Semaphore implementation in rust taken from the previously deprecated std-semaphore

Chapter 3

3.3 Rendezvous

If you have two threads, executing the following:

| Thread A | Thread B |

@aishraj
aishraj / hello_map.py
Created November 6, 2019 12:08 — forked from lizrice/hello_map.py
eBPF hello world
#!/usr/bin/python
from bcc import BPF
from time import sleep
# This outputs a count of how many times the clone and execve syscalls have been made
# showing the use of an eBPF map (called syscall).
program = """
BPF_HASH(syscall);
public class AnimatedActivity extends Activity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
//opening transition animations
overridePendingTransition(R.anim.activity_open_translate,R.anim.activity_close_scale);
}

This Python script creates a git repo with your tweets. Obviously its limited by Twitter API limitations as you cannot retrieve more than 3200 tweets at a time.

Given the fact that Twitter doesn't give a fuck about our data, you may not find your old tweets ever again. So nothing is better than keeping an archive of tweets as a Git repo.

This is inspired by @holman's tweets repo. But this doesn't have a dependency on Madrox. Just plain Python and Git.

Usage

To create an archive of tweets initiate a git repo in a directory with git init. Then put the script in the directory and execute:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>runner</title>
<!-- WinJS references -->
<link href="//Microsoft.WinJS.1.0/css/ui-dark.css" rel="stylesheet" />
<script src="//Microsoft.WinJS.1.0/js/base.js"></script>
<script src="//Microsoft.WinJS.1.0/js/ui.js"></script>
(function () {
"use strict";
var nav = WinJS.Navigation;
function pin() {
// This demo code comes from
// http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.startscreen.secondarytile.aspx
// Prepare package images for use as the Tile Logo and Small Logo in our tile to be pinned.
@aishraj
aishraj / dynamic_alloc_reverse.c
Created November 2, 2012 10:49 — forked from jvranish/dynamic_alloc_reverse.c
Dynamic Allocation without malloc in C (with no mutation!)
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
/*
This is our integer linked list type (Null is an empty list)
(it is immutable, note the consts)
*/
typedef struct IntList_s const * const IntList;
@aishraj
aishraj / dotsandboxes.cc
Created June 9, 2012 13:27 — forked from rvivek/dotsandboxes.cc
Dots and Boxes
#include<iostream>
using namespace std;
#define odd(x) (x&1)
#define even(x) (!(x&1))
int main(){
int x;
cin >> x;