Skip to content

Instantly share code, notes, and snippets.

View TheLittleNaruto's full-sized avatar
🎯
Focusing

TheLittleNaruto TheLittleNaruto

🎯
Focusing
View GitHub Profile
import pandas as pd
pd.__version__
city_names = pd.Series(['San Francisco', 'San Jose', 'Sacramento'])
population = pd.Series([852469, 1015785, 485199])
cities = pd.DataFrame({ 'City name': city_names, 'Population': population })
cities['Area square miles'] = pd.Series([46.87, 176.53, 97.92])
cities['Population density'] = cities['Population'] / cities['Area square miles']
cities
from typing import Any, Dict
class User:
def __init__(self, name: str, village: str) -> None:
self.name = name
self.village = village
public class User {
@SerializedName("name")
String name;
@SerializedName("village")
String villageName;
}
dict = {'name': 'Uzumaki Naruto', 'village': 'Leaf Village'}
# To print any key value, we can do: 
print(dict['name'])
<option name="taskNames">
<list>
<option value="assembleRelease" />
<option value="myCustomTask1" />
<option value="myCustomTask2" />
</list>
</option>
@TheLittleNaruto
TheLittleNaruto / CustomToast.kt
Last active July 21, 2020 09:26
Custom Toast Helper
/*
* Copyright (C) 2019 @author TheLittleNaruto
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@TheLittleNaruto
TheLittleNaruto / hello.c
Created October 3, 2019 10:43
Hello Driver
#include<linux/module.h>
#include<linux/init.h>
#include<linux/kernel.h>
static int hello_init(void){
printk(KERN_ALERT "Hello TheLittleNaruto; it's your first driver which d oes no shit :/\n");
return 0;
}
static void hello_exit(void){
@TheLittleNaruto
TheLittleNaruto / Makefile
Created October 3, 2019 12:38
Make file to compile and build the driver module.
obj-m:=hello.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(shell pwd) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(shell pwd) clean
@TheLittleNaruto
TheLittleNaruto / kwargs_demo.py
Created October 15, 2019 12:52
Understanding kwargs in Python
# taken from https://realpython.com/python-kwargs-and-args/
# concatenate.py
def concatenate(**kwargs):
result = ""
# Iterating over the Python kwargs dictionary
for arg in kwargs.values():
result += arg
return result
print(concatenate(a="Real", b="Python", c="Is", d="Great", e="!"))
# concatenate.py
def concatenate(a: str, b: str):
result = ""
result += a
result += b
return result
print(concatenate(a="Real", b="Python", c="Is", d="Great", e="!"))