Skip to content

Instantly share code, notes, and snippets.

View deepak0004's full-sized avatar

Deepak Thukral deepak0004

View GitHub Profile
@silviucc
silviucc / how_to_build_kernel_on_Ubuntu.txt
Last active May 26, 2021 07:15
Easy way to build a mainline kernel on Ubuntu
Compiling a Linux kernel on Ubuntu
----------------------------------
This should be useful in the event that the user wants to investigate whether a newer kernel allows
certain peripherals to work better (or at all) or some other problems they might encounter while using
the kernel officially provided by Canonical.
As an example, I use the 4.1.5 release from kernel.org.
1) Make sure you have the build environment set up first:
@jgravois
jgravois / _webserver.md
Last active January 9, 2025 09:27
a simple guide for getting a local web server set up

Do I have a web server running?


having a web server turned on doesn't necessarily mean you are serving pages on the world wide web. its what allows you to load your own static files (.html, .js etc.) in a browser via http://.

if you're not sure whether or not you have a web server running, no problem! its easy to confirm.

what happens when you visit http://localhost/?

console.log('Loading event');
var AWS = require('aws-sdk');
var dynamodb = new AWS.DynamoDB();
exports.handler = function(event, context) {
console.log("Request received:\n", JSON.stringify(event));
console.log("Context received:\n", JSON.stringify(context));
var tableName = "OurBlogDemo";
var datetime = new Date().getTime().toString();
@djm
djm / aws.lambda.upload.error.output
Last active July 4, 2020 07:19
Node Lambda Upload Error: "Cross-account pass role is not allowed"
Reading zip file to memory
Uploading zip file to AWS Lambda eu-west-1 with parameters:
{ FunctionName: 'xxx-staging-1-0-0',
FunctionZip: <Buffer 50 478 0b 00 ...>,
Handler: 'index.handler',
Mode: 'event',
Role: 'arn:aws:iam::xxx:role/xxx',
Runtime: 'nodejs',
Description: 'Resizes images for the xxx project.',
MemorySize: '512',
import java.io.IOException;
import org.apache.logging.log4j.core.appender.AbstractManager;
import org.apache.logging.log4j.core.appender.rolling.DefaultRolloverStrategy;
import org.apache.logging.log4j.core.appender.rolling.RollingFileManager;
import org.apache.logging.log4j.core.appender.rolling.RolloverDescription;
import org.apache.logging.log4j.core.appender.rolling.RolloverDescriptionImpl;
import org.apache.logging.log4j.core.appender.rolling.RolloverStrategy;
import org.apache.logging.log4j.core.appender.rolling.action.AbstractAction;
import org.apache.logging.log4j.core.appender.rolling.action.Action;
@markusklems
markusklems / lambda-dynamo
Last active November 24, 2024 01:48
Short aws lambda sample program that puts an item into dynamodb
// create an IAM Lambda role with access to dynamodb
// Launch Lambda in the same region as your dynamodb region
// (here: us-east-1)
// dynamodb table with hash key = user and range key = datetime
console.log('Loading event');
var AWS = require('aws-sdk');
var dynamodb = new AWS.DynamoDB({apiVersion: '2012-08-10'});
exports.handler = function(event, context) {
@arulrajnet
arulrajnet / tweets_dumper.py
Created January 4, 2015 18:08
Dump all tweets as CSV of given twitter handle using #Tweepy https://github.com/tweepy/tweepy
# -*- coding: utf-8 -*-
import tweepy # https://github.com/tweepy/tweepy
import json
import csv
import sys
# Twitter API credentials
consumer_key = "your_consumer_key"
consumer_secret = "your_consumer_secret"
@Avyd
Avyd / Compile to .deb
Last active January 14, 2025 08:42
Compile kernel to installable .deb package
#Install necessary things
apt-get update
apt-get install kernel-package libncurses5-dev fakeroot wget bzip2 build-essential -y
#Get the kernel
cd /usr/src
wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.13.tar.xz
wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.13.tar.sign
gpg --verify linux-3.13.tar.sign
tar xpvf linux-3.13.tar.xz
@mblondel
mblondel / letor_metrics.py
Last active September 19, 2024 06:13
Learning to rank metrics.
# (C) Mathieu Blondel, November 2013
# License: BSD 3 clause
import numpy as np
def ranking_precision_score(y_true, y_score, k=10):
"""Precision at rank k
Parameters
@barrysteyn
barrysteyn / Leetcode: Search In A Sorted Array.md
Last active November 26, 2017 14:33
Leetcode online judge "Word Search" solution.

LeetCode Problem: Word Search\

http://oj.leetcode.com/problems/word-search/

Problem Description

Given a 2D board and a word, find if the word exists in the grid.

The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or vertically neighboring. The same letter cell may not be used more than once.

For example, Given board =