Skip to content

Instantly share code, notes, and snippets.

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

Ahmad Abdulnasir Shuaib ahmadabdulnasir

🏠
Working from home
View GitHub Profile
@jkjung-avt
jkjung-avt / tegra-cam.py
Last active October 11, 2023 08:20
Capture and display video from either IP CAM, USB webcam, or the Tegra X2/X1 onboard camera.
# --------------------------------------------------------
# Camera sample code for Tegra X2/X1
#
# This program could capture and display video from
# IP CAM, USB webcam, or the Tegra onboard camera.
# Refer to the following blog post for how to set up
# and run the code:
# https://jkjung-avt.github.io/tx2-camera-with-python/
#
# Written by JK Jung <jkjung13@gmail.com>
@sirodoht
sirodoht / migrate-django.md
Last active June 12, 2024 17:22
How to migrate Django from SQLite to PostgreSQL

How to migrate Django from SQLite to PostgreSQL

Dump existing data:

python3 manage.py dumpdata > datadump.json

Change settings.py to Postgres backend.

Make sure you can connect on PostgreSQL. Then:

@r00tdaemon
r00tdaemon / Install PyQt5 on Ubuntu with python3 .md
Last active May 4, 2024 04:08
Install PyQt5 on Ubuntu with python3. Steps to set up PyQt5 (ubuntu). With python code generation

Installation

pip3 install --user pyqt5  
sudo apt-get install python3-pyqt5  
sudo apt-get install pyqt5-dev-tools
sudo apt-get install qttools5-dev-tools

Configuring to run from terminal

@martin2250
martin2250 / schrodingersim.py
Created June 8, 2017 19:47
Simulate Schrodinger Equation in 1D with python
#!/usr/bin/python
from __future__ import print_function
from __future__ import division
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
def D_wrap(A, dX):
d = A - np.roll(A, 1)
d = 0.5 * (d + np.roll(d, -1))
@mdp
mdp / luhn.java
Created March 21, 2014 17:38
Luhn algorithm (mod10) in Java
/**
* Luhn Class is an implementation of the Luhn algorithm that checks validity of a credit card number.
*
* @author <a href="http://www.chriswareham.demon.co.uk/software/Luhn.java">Chris Wareham</a>
* @version Checks whether a string of digits is a valid credit card number according to the Luhn algorithm. 1. Starting with the second to last digit and
* moving left, double the value of all the alternating digits. For any digits that thus become 10 or more, add their digits together. For example,
* 1111 becomes 2121, while 8763 becomes 7733 (from (1+6)7(1+2)3). 2. Add all these digits together. For example, 1111 becomes 2121, then 2+1+2+1 is
* 6; while 8763 becomes 7733, then 7+7+3+3 is 20. 3. If the total ends in 0 (put another way, if the total modulus 10 is 0), then the number is valid
* according to the Luhn formula, else it is not valid. So, 1111 is not valid (as shown above, it comes out to 6), while 8763 is valid (as shown
* above, it comes ou
@wbroek
wbroek / genymotionwithplay.txt
Last active February 12, 2024 03:22
Genymotion with Google Play Services for ARM
NOTE: Easier way is the X86 way, described on https://www.genymotion.com/help/desktop/faq/#google-play-services
Download the following ZIPs:
ARM Translation Installer v1.1 (http://www.mirrorcreator.com/files/0ZIO8PME/Genymotion-ARM-Translation_v1.1.zip_links)
Download the correct GApps for your Android version:
Google Apps for Android 6.0 (https://www.androidfilehost.com/?fid=24052804347835438 - benzo-gapps-M-20151011-signed-chroma-r3.zip)
Google Apps for Android 5.1 (https://www.androidfilehost.com/?fid=96042739161891406 - gapps-L-4-21-15.zip)
Google Apps for Android 5.0 (https://www.androidfilehost.com/?fid=95784891001614559 - gapps-lp-20141109-signed.zip)
@isDipesh
isDipesh / install-mscorefonts.sh
Created December 27, 2012 14:28
Install 'Times New Roman' and other proprietary fonts in Fedora
yum install rpm-build cabextract ttmkfdir
wget http://corefonts.sourceforge.net/msttcorefonts-2.5-1.spec
rpmbuild -bb msttcorefonts-2.5-1.spec
rpm -ivh $HOME/rpmbuild/RPMS/noarch/msttcorefonts-2.5-1.noarch.rpm
fc-cache -f -v
@SahilC
SahilC / clock.asm
Created December 19, 2012 10:31
A simple assembly code for the 8086 microprocessor to display a digital clock in real time.
.model small
.stack 1024
.data
.code
start:
mov ax,@data
mov ds,ax
extrn writesint:proc
mov ah,2ch
int 21h
@sibprogrammer
sibprogrammer / merge-srt.rb
Created September 22, 2010 10:00
Merge two subtitles files into single one
#!/usr/bin/env ruby
def load_subtitles(filename, as_hash = false)
subtitles = as_hash ? {} : []
File.open(filename) do |file|
while !file.eof? do
record = []
while (line = file.gets).strip != '' and !file.eof? do
record << line