Skip to content

Instantly share code, notes, and snippets.

View jkariscodes's full-sized avatar
🎯
Focusing

Joseph Kariuki jkariscodes

🎯
Focusing
View GitHub Profile
# Given an integer, return the integer with reversed digits.
# Note: The integer could be either positive or negative.
def solution(x):
string = str(x)
if string[0] == '-':
return int('-'+string[:0:-1])
else:
return int(string[::-1])
@ssaurel
ssaurel / MainActivity.java
Created August 22, 2018 11:39
Main Activity for the GPS Tutorial on the SSaurel's Blog
package com.ssaurel.fusedlocation;
import android.Manifest;
import android.content.DialogInterface;
import android.content.pm.PackageManager;
import android.location.Location;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
@beeman
beeman / remove-all-from-docker.sh
Created November 15, 2016 03:04
Remove all from Docker
# Stop all containers
docker stop `docker ps -qa`
# Remove all containers
docker rm `docker ps -qa`
# Remove all images
docker rmi -f `docker images -qa `
# Remove all volumes
@santisbon
santisbon / Update-branch.md
Last active March 21, 2024 15:50
Deploying from #Git branches adds flexibility. Bring your feature branch up to date with master and deploy it to make sure everything works. If everything looks good the branch can be merged. Otherwise, you can deploy your master branch to return production to its stable state.

Updating a feature branch

First we'll update your local master branch. Go to your local project and check out the branch you want to merge into (your local master branch)

$ git checkout master

Fetch the remote, bringing the branches and their commits from the remote repository. You can use the -p, --prune option to delete any remote-tracking references that no longer exist in the remote. Commits to master will be stored in a local branch, remotes/origin/master.

@dlebech
dlebech / uwsgi-emperor
Created February 2, 2015 16:09
uWSGI start/stop script that can be added to /etc/init.d on Ubuntu Linux and used with "sudo service uwsgi-emperor start"
#!/usr/bin/env bash
### BEGIN INIT INFO
# Provides: uwsgi-emperor
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the uwsgi emperor app server
# Description: starts uwsgi emperor app server using start-stop-daemon
@lovesh
lovesh / admin.py
Last active November 7, 2019 19:37
django-admin register all models
"""
Here models are in different modules and the models.py imports them from different modules like this
from model1 import * # or the name of models you want to import
from model2 import User
or you might write all your models in models.py
"""
@thanhleviet
thanhleviet / geoserver.conf
Created July 3, 2012 15:30
Setting up proxy for geoserver with nginx
Tested on nginx version 1.1.9, ubuntu 12.04
-Command lines in order:
sudo touch /etc/nginx/site-availables/geoserver.conf
sudo vi /etc/nginx/site-availables/geoserver.conf
sudo ln -s /etc/nginx/site-availables/geoserver.conf /etc/nginx/site-enabled/geoserver.conf
sudo service nginx start
Content of geoserver.conf
server {