Skip to content

Instantly share code, notes, and snippets.

View anoopelias's full-sized avatar

Anoop Elias anoopelias

View GitHub Profile
@anoopelias
anoopelias / Rust101_Session3.md
Last active March 11, 2024 12:47
Rust101_Session3

Rust 101 - Session 3

Recap

Ownership

fn main() {
    let nums = vec![2, 4, 6];
 let nums2 = nums;
@anoopelias
anoopelias / kqueue.go
Created March 4, 2023 16:41
Redis set/get implementation in Go using kqueue
package main
import (
"fmt"
"strings"
"syscall"
)
func main() {
@anoopelias
anoopelias / non-block.go
Created March 4, 2023 15:22
Redis set/get implementation in Go using non-blocking io
package main
import (
"fmt"
"strings"
"syscall"
)
func main() {
@anoopelias
anoopelias / goroutines.go
Last active March 4, 2023 10:48
Redis set/get implementation in Go using goroutines
package main
import (
"bufio"
"fmt"
"net"
"strconv"
"strings"
)
@anoopelias
anoopelias / Readme.md
Last active August 12, 2019 04:37
Firefox WebExtensions API `search.get()` throws an error when invoked from Ubuntu distribution

Prerequisites

Firefox 68.0.1 (64bit) installed from Ubuntu distribution,

Steps to reproduce

  1. Copy the files manifest.json and background.js in to a folder
  2. Run $ web-ext run
  3. In address bar type about:debugging. Temporary extensions 'Test Extension' will be loaded.
  4. Click 'Debug'

Keybase proof

I hereby claim:

  • I am anoopelias on github.
  • I am anoopelias (https://keybase.io/anoopelias) on keybase.
  • I have a public key ASBFp65xGHBRZOaP1q61K6Hvb_KSUY9TZzbbnSAh4ythugo

To claim this, I am signing this object:

use std::cmp::max;
fn largest2(arr: [i32; 5]) -> i32 {
arr.iter().fold(0, |num, &x| {
max(num, x)
})
}
fn largest3(arr: [i32; 5]) -> i32 {
arr.iter().fold(0, max) // Do Not compile!
/**
* __main__
*/
var bot;
var botId;
var lenColumns;
var lenRows;
function substring(txt, str) {
var dfa = compile(str);
var curr = 0;
for(var i=0; i<txt.length; i++) {
curr = next(dfa, curr, txt.charAt(i));
if(curr === str.length)
return true;
}
import java.util.ArrayList;
import java.util.List;
class TestClass {
private static final int[] PRIMES = { 2, 3, 5, 7, 11, 13, 17, 19, 23 };
public static void main(String args[]) throws Exception {
goodVsBad(23, 46, 22);
}