Skip to content

Instantly share code, notes, and snippets.

View dnldsht's full-sized avatar

Donald Shtjefni dnldsht

View GitHub Profile
Vue.js 2 hrs 33 mins ██████▎░░░░░░░░░░░░░░ 30.0%
Dart 1 hr 14 mins ███░░░░░░░░░░░░░░░░░░ 14.6%
Markdown 1 hr 2 mins ██▌░░░░░░░░░░░░░░░░░░ 12.3%
PHP 51 mins ██░░░░░░░░░░░░░░░░░░░ 10.0%
Other 42 mins █▋░░░░░░░░░░░░░░░░░░░ 8.2%
@dnldsht
dnldsht / arch-linux
Last active April 16, 2018 04:15 — forked from njam/arch-linux
Install Arch Linux on XPS 13 9360
# Installation on Dell XPS
# Please also consult official docu:
# https://wiki.archlinux.org/index.php/Installation_Guide
# https://wiki.archlinux.org/index.php/Dell_XPS_13_(9360)
# https://wiki.archlinux.org/index.php/Dell_XPS_15_(9550)
# Boot from the usb.
# F12 to enter boot menu
# Connect to Internet
title Arch Linux
linux /vmlinuz-linux
initrd /intel-ucode.img
initrd /initramfs-linux.img
options luks.uuid=<uuid> luks.name=<uuid>=luks root=/dev/vg0/root rw
@dnldsht
dnldsht / console
Last active March 16, 2017 16:01
Utils to find the length of a number https://redd.it/5yvkq2
0.00034523s ~ len_str -> [(33732, 5), (18135, 5), (32243, 5), (81089, 5), (68647, 5), (2366, 4), (9349, 4), (85333, 5), (95218, 5), (47511, 5), (21534, 5), (38933, 5), (5711, 4), (27806, 5), (88600, 5), (2308, 4), (39123, 5), (48523, 5), (93044, 5), (4050, 4), (76932, 5), (91507, 5), (52110, 5), (25791, 5), (17215, 5), (33635, 5), (89989, 5), (87507, 5), (49000, 5), (97053, 5), (68087, 5), (12855, 5), (25960, 5), (97564, 5), (45335, 5), (44133, 5), (90997, 5), (13684, 5), (54400, 5), (56286, 5), (29751, 5), (10289, 5), (84436, 5), (31951, 5), (50777, 5), (60118, 5), (31703, 5), (18884, 5), (63052, 5), (47937, 5), (83097, 5), (59896, 5), (44730, 5), (22449, 5), (20891, 5), (71368, 5), (54919, 5), (23886, 5), (55558, 5), (44528, 5), (62674, 5), (94921, 5), (39387, 5), (69670, 5), (66154, 5), (76111, 5), (58857, 5), (88723, 5), (55477, 5), (7517, 4), (45595, 5), (74720, 5), (79680, 5), (21093, 5), (8605, 4), (13044, 5), (42621, 5), (82595, 5), (96530, 5), (28338, 5), (57982, 5), (7373, 4), (38178, 5), (37716, 5)
import random
from time import sleep
def green(s):
return '\033[92m%s\033[0m' % s
def red(s):
return '\033[91m%s\033[0m' % s
class players:
@dnldsht
dnldsht / AdvancedRequestHelper.java
Created September 7, 2016 12:57
Utils for HTTP request (also with queue when there is no connection)
public class AdvancedRequestHelper extends RequestsHelper {
private static AdvancedRequestHelper mInstance;
UnProcessedRequests unProcessedRequests;
private Context ctx;
public static synchronized AdvancedRequestHelper getInstance(Context context) {
if (mInstance == null) {
mInstance = new AdvancedRequestHelper(context);
}
@dnldsht
dnldsht / RequestsHelper.java
Last active September 7, 2016 12:49
RequestsHelper for volley
public class RequestsHelper {
private RequestQueue mRequestQueue;
private ImageLoader mImageLoader;
private static RequestsHelper mInstance;
private static Context ctx;
public static synchronized RequestsHelper getInstance(Context context) {
if (mInstance == null)
mInstance = new RequestsHelper(context);
@dnldsht
dnldsht / PreferenceUtil.java
Created July 13, 2016 08:45
Shared Preferences Helper
public class PreferenceUtil {
private static PreferenceUtil instance;
private SharedPreferences SP;
private PreferenceUtil(Context mContext) {
SP = PreferenceManager.getDefaultSharedPreferences(mContext);
}
public static PreferenceUtil getInstance(Context context) {
@dnldsht
dnldsht / PermissionsUtils.java
Created July 13, 2016 08:44
Permissions helper for Android 6+
public final class PermissionsUtils {
private static boolean checkPermission(Context context, String permission) {
return ContextCompat.checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED;
}
public static boolean isCameraGranted(Context context) {
return checkPermission(context, Manifest.permission.CAMERA);
}
private class PathFileObserver extends FileObserver{
static final String TAG="FILEOBSERVER";
/**
* should be end with File.separator
*/
String rootPath;
static final int mask = (FileObserver.CREATE |
FileObserver.DELETE |
FileObserver.DELETE_SELF |
FileObserver.MODIFY |