Skip to content

Instantly share code, notes, and snippets.

def change(s, a, b):
s = s[:a - 1] + b + s[a:]
return s
def substr(s, b, c, d):
a = list(s[b - 1:c])
l = list(map(lambda x: ord(x), a))
min_ascii = min(l)
while ord(a[0]) != min_ascii:
a.insert(0, a.pop())
@ajitid
ajitid / eclipse.ini
Last active November 15, 2017 06:01
eclipse.ini for Ubuntu (Linux)
-startup
plugins/org.eclipse.equinox.launcher_1.4.0.v20161219-1356.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.500.v20170531-1133
-product
org.eclipse.epp.package.jee.product
-showsplash
org.eclipse.epp.package.common
--launcher.defaultAction
openFile
@ajitid
ajitid / applet.java
Created August 15, 2017 14:09
Basic Applet
import java.awt.*;
import java.applet.*;
public class applet extends Applet implements Runnable {
String str;
int x,y;
Thread th;
public void init() {
str = "I like to move it move it";
x = y = 5;
@ajitid
ajitid / README.md
Last active May 23, 2022 20:05
Adding apps to search or launcher in Ubuntu (and in GNOME)

WM_CLASS(STRING) key is needed for all Java based applications because if not given, GNOME may not group them in launcher. Use xprop WM_CLASS command and click on a window to get its class.

@ajitid
ajitid / config.fish
Last active October 17, 2020 12:42
[OLD] nano ~/.config/fish/config.fish - trying fish shell
set PATH "/home/ajitid/miniconda3/bin" $PATH
function mkcd
mkdir -p $argv
cd $argv
end
source (conda info --root)/etc/fish/conf.d/conda.fish
@ajitid
ajitid / steps.md
Last active June 25, 2022 16:05
Walkthrough - React Native development on Ubuntu/Elementary

Guide for React Native development on Ubuntu/Elementary

Help to update/improve. Also if you find anything that is deprecated here or find a typo, do tell it. Thanks!

Assumptions

  • This guide mainly covers steps (including and) after ejection from create-react-native-app (CRNA).
  • You should know how to run your app using CRNA and Expo app from Play Store. Two issue I've faced and fixed - (1) watchers fixed permanently by echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p and (2) by using yarn over npmv5 to avoid buggy installation of CRNA projects as well as of other packages that are installed in it later.
  • This guide does not cover setting up any Android emulator or using Android Studio (we will go full cli instead).
@ajitid
ajitid / index.js
Last active March 12, 2018 07:49
JS Node
class Node{
constructor(data) {
this.data = data;
this.children = []
}
add(data) {
this.children.push(new Node(data))
}
}
@ajitid
ajitid / admin.py
Created May 7, 2018 07:46
Django - Best way to create custom User models
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as DefaultUserAdmin
from .models import User
class UserAdmin(DefaultUserAdmin):
model = User
fieldsets = (
let x=1,up=!1;setInterval(()=>{(75===x||1===x)&&(up=!up),up?x++:x--,console.log(`%c${`■`.repeat(x)}`,`color: hsl(${2*x}, 100%, 50%)`)},10);
import "./index.css"
import React, { Component } from "react"
import FaAutomobile from "react-icons/lib/fa/automobile"
import FaBed from "react-icons/lib/fa/bed"
import FaPlane from "react-icons/lib/fa/plane"
import FaSpaceShuttle from "react-icons/lib/fa/space-shuttle"
import * as text from "./text"
const TabHead = props => {
const { data, activeIndex, selectTabIndex } = props