Skip to content

Instantly share code, notes, and snippets.

View SamiMohsin's full-sized avatar
🏠
Working from home

SamiMohsin

🏠
Working from home
View GitHub Profile
@SamiMohsin
SamiMohsin / gist:abb1a48a23443eb10a0b2e223c58e47b
Created April 15, 2020 20:23 — forked from willyaranda/gist:11376151
List of MCC-MNC, Countries, Prefixes and telco
289 88 ab Abkhazia 7 A-Mobile
289 68 ab Abkhazia 7 A-Mobile
289 67 ab Abkhazia 7 Aquafon
412 88 af Afghanistan 93 Afghan Telecom Corp. (AT)
412 80 af Afghanistan 93 Afghan Telecom Corp. (AT)
412 01 af Afghanistan 93 Afghan Wireless/AWCC
412 40 af Afghanistan 93 Areeba
412 50 af Afghanistan 93 Etisalat
412 20 af Afghanistan 93 Roshan
276 01 al Albania 355 AMC Mobil
@SamiMohsin
SamiMohsin / withsqlite.py
Created December 16, 2019 16:56 — forked from miku/withsqlite.py
Simple sqlite3 context manager for Python.
#!/usr/bin/env python
import sqlite3
class dbopen(object):
"""
Simple CM for sqlite3 databases. Commits everything at exit.
"""
def __init__(self, path):
self.path = path
@SamiMohsin
SamiMohsin / pympstore.py
Created December 16, 2019 16:55 — forked from cessor/pympstore.py
Multiprocessing & Sqlite Example
import sqlite3
import multiprocessing
'''
This program starts a daemon process that listens on a queue.
It then starts 10 processes that place integers in the queue.
The listening daemon pulls the integers out of the queue and
stores them in the database.
'''
DB_FILENAME = 'db.sqlite'
@SamiMohsin
SamiMohsin / model.py
Created December 16, 2019 16:55 — forked from BideoWego/model.py
Simple Python Model class for use with SQLite3
import sqlite3
class Model:
def __init__(self, db, table):
self.db = db
self.table = table
self.connection = sqlite3.connect(db + '.db')
self.connection.row_factory = sqlite3.Row
def create(self, row):
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public class RssFeedProvider {
public static List<RssItem> parse(String rssFeed) {
List<RssItem> list = new ArrayList<>();
Random r = new Random();
// random number of item but at least 5
Integer number = r.nextInt(10) + 5;
public class RssItem {
private String pubDate;
private String description;
private String link;
private String title;
public RssItem() {
}
public RssItem(String title, String link) {
import 'dart:async';
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:http/http.dart';
class Post {
final int userId;
@SamiMohsin
SamiMohsin / data types float.ipynb
Last active September 12, 2019 21:12
short intro python float
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@SamiMohsin
SamiMohsin / data types integer.ipynb
Last active September 12, 2019 20:58
short intro python simple (integer)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@SamiMohsin
SamiMohsin / qemu_osx_rpi_raspbian_jessie.sh
Created August 16, 2019 07:06 — forked from hfreire/qemu_osx_rpi_raspbian_jessie.sh
How to emulate a Raspberry Pi (Raspbian Jessie) on Mac OSX (El Capitan)
# Install QEMU OSX port with ARM support
sudo port install qemu +target_arm
export QEMU=$(which qemu-system-arm)
# Dowload kernel and export location
curl -OL \
https://github.com/dhruvvyas90/qemu-rpi-kernel/blob/master/kernel-qemu-4.1.7-jessie
export RPI_KERNEL=./kernel-qemu-4.1.7-jessie
# Download filesystem and export location