Skip to content

Instantly share code, notes, and snippets.

@smartinsightsfromdata
smartinsightsfromdata / app.py
Created February 2, 2024 15:13 — forked from jcheng5/app.py
Shiny for Python module for console you can write to
from shiny import App, reactive, render, ui, module
from shiny.session import Session
from contextlib import redirect_stdout, redirect_stderr
import asyncio
from shiny_console import Console, console_ui, console_server
# == Example usage =======================================
app_ui = ui.page_fluid(
@smartinsightsfromdata
smartinsightsfromdata / juliainstall.md
Created December 6, 2023 19:50 — forked from utamadonny/juliainstall.md
Install Julia in Linux (Ubuntu 20.04 LTS)

Download

wget https://julialang-s3.julialang.org/bin/linux/x64/1.Y/julia-X.Y.X-linux-x86_64.tar.gz

example

wget https://julialang-s3.julialang.org/bin/linux/x64/1.6/julia-1.6.2-linux-x86_64.tar.gz

Extract

@smartinsightsfromdata
smartinsightsfromdata / twitter crawler.txt
Created March 22, 2019 23:16 — forked from vickyqian/twitter crawler.txt
A Python script to download all the tweets of a hashtag into a csv
import tweepy
import csv
import pandas as pd
####input your credentials here
consumer_key = ''
consumer_secret = ''
access_token = ''
access_token_secret = ''
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
@smartinsightsfromdata
smartinsightsfromdata / twitter crawler.txt
Created March 22, 2019 23:16 — forked from vickyqian/twitter crawler.txt
A Python script to download all the tweets of a hashtag into a csv
import tweepy
import csv
import pandas as pd
####input your credentials here
consumer_key = ''
consumer_secret = ''
access_token = ''
access_token_secret = ''
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
@smartinsightsfromdata
smartinsightsfromdata / einstein.pl
Created February 24, 2019 00:15 — forked from jgilchrist/einstein.pl
A Prolog solution to Einstein's Riddle
right_of(X, Y) :- X is Y+1.
left_of(X, Y) :- right_of(Y, X).
next_to(X, Y) :- right_of(X, Y).
next_to(X, Y) :- left_of(X, Y).
solution(Street, FishOwner) :-
Street = [
house(1, Nationality1, Color1, Pet1, Drinks1, Smokes1),
house(2, Nationality2, Color2, Pet2, Drinks2, Smokes2),

Technical details for https://stackoverflow.com/a/44169445/6730571

Details of investigation:

On a base system, /usr/bin/java is a symlink that points to /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, which is an Apple wrapper tool that locates and executes the actual java.

(Do not touch anything in those 2 system directories. It should actually be impossible due to "System Integrity Protection" anyway.)

If you don't have Java installed, attempting to execute java will open a dialog that invites you to install it.

@smartinsightsfromdata
smartinsightsfromdata / python_environment_setup.md
Created September 22, 2018 20:21 — forked from wronk/python_environment_setup.md
Setting up your python development environment (with pyenv, virtualenv, and virtualenvwrapper)

Overview

When you're working on multiple coding projects, you might want a couple different version of Python and/or modules installed. That way you can keep each project in its own sandbox instead of trying to juggle multiple projects (each with different dependencies) on your system's version of Python. This intermediate guide covers one way to handle multiple Python versions and Python environments on your own (i.e., without a package manager like conda). See the Using the workflow section to view the end result.

Use cases

  1. Working on 2+ projects that each have their own dependencies; e.g., a Python 2.7 project and a Python 3.6 project, or developing a module that needs to work across multiple versions of Python. It's not reasonable to uninstall/reinstall modules every time you want to switch environments.
  2. If you want to execute code on the cloud, you can set up a Python environment that mirrors the relevant
@smartinsightsfromdata
smartinsightsfromdata / PythonSetup.md
Created September 17, 2018 20:27 — forked from patriciogonzalezvivo/PythonSetup.md
How to install Python correctly on Mac OSX

Install Homebrew

ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"

Add PATH to ~/.bash_profile and ~/.zshrc

export PATH=/usr/local/bin:$PATH
@smartinsightsfromdata
smartinsightsfromdata / launch_sublime_from_terminal.markdown
Created September 4, 2018 10:47 — forked from artero/launch_sublime_from_terminal.markdown
Launch Sublime Text 2 from the Mac OS X Terminal

Launch Sublime Text 2 from the Mac OS X Terminal

Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html

Installation

@smartinsightsfromdata
smartinsightsfromdata / config.txt
Last active September 3, 2018 22:28
ubuntu - python image
vi ~/.bashrc
alias python=python3.6
alias pip=pip3
source ~/.bashrc
# sudo su -
sudo apt update
sudo apt upgrade