Skip to content

Instantly share code, notes, and snippets.

View nuhil's full-sized avatar
🎯
Focusing

Nuhil Mehdy nuhil

🎯
Focusing
View GitHub Profile
@nuhil
nuhil / usage.rst
Created July 15, 2017 03:15
Miniconda Commands

Managing environments

With conda, you can create, export, list, remove, and update environments that have different versions of Python and/or packages installed in them. Switching or moving between environments is called activating the environment. You can even share an environment file with a coworker.

Anytime you wish to see the full documentation for any command, type the command followed by --help. For example, to learn about the conda environment command:

@nuhil
nuhil / osx-tips.md
Created June 17, 2015 07:47
OSX Tips & Tricks

#OSX Tips & Tricks
Disable the Internal Laptop Display
sudo nvram boot-args="niog=1"
After executing the terminal command, reboot and close the lid immediately. Keep the lid closed during boot up, and once logged in to a user account in OS X, open the lid. If in sleep mode, just close the lid before waking the MacBook Pro and open the lid once again after logging back in.

To undo and return to normal display behavior:
sudo nvram -d boot-args
Similar to prior versions of OS X, resetting the PRAM can also disable the setting.

@nuhil
nuhil / js.md
Last active November 20, 2021 18:06
Javascript Handbook
from pyspark.sql import SparkSession
spark = SparkSession.builder.getOrCreate()
spark
!apt-get update
!wget -q https://mirror.softaculous.com/apache/spark/spark-3.0.2/spark-3.0.2-bin-hadoop2.7.tgz
!tar xf spark-3.0.2-bin-hadoop2.7.tgz
!pip install -q findspark
import os
# Optional JDK look up step
# os.environ["JAVA_HOME"] = "/usr/lib/jvm/java-11-openjdk-amd64"
os.environ["SPARK_HOME"] = "/content/spark-3.0.2-bin-hadoop2.7"

Set the base image to Ubuntu must be first instruction - use docker search to find images

FROM ubuntu # <image>
FROM ubuntu:latest # - <image>:<tag>
FROM ubuntu:precise (LTS)

Set the maintainer info

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.keys import Keys
import os
chrome_driver = os.path.join(os.getcwd(), "chromedriver")
urls = []
pages = 100
for page in range(1, pages+1):
# Run this script using following command
# $ python generate-iconset.py icon.png
# Then execute the following command to create .icns
# $ iconutil -c icns icon.iconset
import os
import sys
import pathlib
import subprocess
var http = require('http'),
fs = require('fs');
var server = http.createServer().listen(3000);
server.on('request', function (request, response) {
fs.readFile('file.txt', 'utf-8', function (err, data) {
response.end(data);
});
});
var http = require('http');
var server = http.createServer().listen(3000);
server.on('request', function (request, response) {
response.end('Hello World!');
});
console.log("Listening on port 3000...")
// Note: যদিও এভাবে এই কোডটি লেখা হয়ে থাকে না কিন্তু request ইভেন্টের অস্তিত্ব বোঝাতে এভাবে লেখা