Skip to content

Instantly share code, notes, and snippets.

@Artistan
Artistan / redis_cli_install_update.sh
Last active January 26, 2024 01:08
Install redis-cli on your other machines.
if [[ -d redis ]]
then
cd redis
git pull
else
git clone http://github.com/antirez/redis.git
cd redis && git checkout 4.0
fi
make redis-cli
@alexlee-gk
alexlee-gk / configure_cuda_p70.md
Last active March 19, 2024 17:47
Use integrated graphics for display and NVIDIA GPU for CUDA on Ubuntu 14.04

This was tested on a ThinkPad P70 laptop with an Intel integrated graphics and an NVIDIA GPU:

lspci | egrep 'VGA|3D'
00:02.0 VGA compatible controller: Intel Corporation Device 191b (rev 06)
01:00.0 VGA compatible controller: NVIDIA Corporation GM204GLM [Quadro M3000M] (rev a1)

A reason to use the integrated graphics for display is if installing the NVIDIA drivers causes the display to stop working properly. In my case, Ubuntu would get stuck in a login loop after installing the NVIDIA drivers. This happened regardless if I installed the drivers from the "Additional Drivers" tab in "System Settings" or the ppa:graphics-drivers/ppa in the command-line.

@karpathy
karpathy / pg-pong.py
Created May 30, 2016 22:50
Training a Neural Network ATARI Pong agent with Policy Gradients from raw pixels
""" Trains an agent with (stochastic) Policy Gradients on Pong. Uses OpenAI Gym. """
import numpy as np
import cPickle as pickle
import gym
# hyperparameters
H = 200 # number of hidden layer neurons
batch_size = 10 # every how many episodes to do a param update?
learning_rate = 1e-4
gamma = 0.99 # discount factor for reward
@Nemitek
Nemitek / keras_prediction.py
Created October 22, 2015 04:11
Predicting sequences of vectors (regression) in Keras using RNN - LSTM (original by danielhnyk.cz) - fixed for Keras 0.2.0
import pandas as pd
from random import random
flow = (list(range(1,10,1)) + list(range(10,1,-1)))*1000
pdata = pd.DataFrame({"a":flow, "b":flow})
pdata.b = pdata.b.shift(9)
data = pdata.iloc[10:] * random() # some noise
import numpy as np
@hnykda
hnykda / keras_prediction.py
Last active August 21, 2020 01:33
Predicting sequences of vectors (regression) in Keras using RNN - LSTM (danielhnyk.cz)
import pandas as pd
from random import random
flow = (list(range(1,10,1)) + list(range(10,1,-1)))*100
pdata = pd.DataFrame({"a":flow, "b":flow})
pdata.b = pdata.b.shift(9)
data = pdata.iloc[10:] * random() # some noise
import numpy as np
@PurpleBooth
PurpleBooth / README-Template.md
Last active April 18, 2024 00:56
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@paulochf
paulochf / ipython_notebook_large_width.py
Last active September 22, 2022 22:22
IPython/Jupyter Notebook enlarge/change cell width
from IPython.display import display, HTML
display(HTML(data="""
<style>
div#notebook-container { width: 95%; }
div#menubar-container { width: 65%; }
div#maintoolbar-container { width: 99%; }
</style>
"""))
@carols10cents
carols10cents / c#-to-rust.md
Last active April 18, 2024 22:55
C# to Rust Cheat Sheet

Thanks to @seejee for making this for me!!!

C# to Rust Cheat Sheet

The goal of this is to have an easily-scannable reference for the most common syntax idioms in C# and Rust so that programmers most comfortable with C# can quickly get through the syntax differences and feel like they could read and write basic Rust programs.

What do you think? Does this meet its goal? If not, why not?

Variables

@hunterowens
hunterowens / connect_and_load.py
Last active December 9, 2023 16:27
Pandas and MSSQL
import pymssql
import pandas as pd
## instance a python db connection object- same form as psycopg2/python-mysql drivers also
conn = pymssql.connect(server="172.0.0.1", user="howens",password="some_fake_password", port=63642) # You can lookup the port number inside SQL server.
## Hey Look, college data
stmt = "SELECT * FROM AlumniMirror..someTable"
# Excute Query here
df = pd.read_sql(stmt,conn)
@brandonmwest
brandonmwest / example.cs
Last active January 16, 2024 15:52
Generating base64-encoded Authorization headers in a variety of languages
httpClient.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue(
"Basic",
Convert.ToBase64String(
System.Text.ASCIIEncoding.ASCII.GetBytes(
string.Format("{0}:{1}", username, password))));