Skip to content

Instantly share code, notes, and snippets.

View cryptid11's full-sized avatar
™️
this planet is a super awesome joke

cryptid11

™️
this planet is a super awesome joke
View GitHub Profile
#!/usr/bin/python
import socket
import struct
import sys
# We want unbuffered stdout so we can provide live feedback for
# each TTL. You could also use the "-u" flag to Python.
class flushfile(file):
def __init__(self, f):
@bgallagh3r
bgallagh3r / wp.sh
Last active March 24, 2024 03:12
Wordpress: Bash Install Script -- Downloads latest WP version, updates wp-config with user supplied DB name, username and password, creates and CHMOD's uploads dir, copies all the files into the root dir you run the script from, then deletes itself!
#!/bin/bash -e
clear
echo "============================================"
echo "WordPress Install Script"
echo "============================================"
echo "Database Name: "
read -e dbname
echo "Database User: "
read -e dbuser
echo "Database Password: "
@mitjat
mitjat / udacityplots.py
Created September 3, 2012 19:16
A drop-in replacement for the udacityplots library
import base64
import json
import matplotlib, matplotlib.pyplot
import numpy
import types
def show_plot(width, height=None):
"""
A decorator -- show the matplotlib plot after `f` completes.
Takes optional parameters (width, height) determining the size of the plot.
@willurd
willurd / web-servers.md
Last active April 26, 2024 18:00
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@rossant
rossant / raytracing.py
Last active December 24, 2023 12:50
Very simple ray tracing engine in (almost) pure Python. Depends on NumPy and Matplotlib. Diffuse and specular lighting, simple shadows, reflections, no refraction. Purely sequential algorithm, slow execution.
"""
MIT License
Copyright (c) 2017 Cyrille Rossant
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@vladignatyev
vladignatyev / progress.py
Last active March 31, 2024 22:54
Python command line progress bar in less than 10 lines of code.
# The MIT License (MIT)
# Copyright (c) 2016 Vladimir Ignatev
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the Software
# is furnished to do so, subject to the following conditions:
#
@maraoz
maraoz / Original version
Last active October 5, 2016 13:25
Hashed Timelock Contract (HTLC) as proposed in lightning.network paper
OP_DEPTH 3 OP_EQUAL
OP_IF
OP_HASH160 <hash160(R)> OP_EQUALVERIFY
OP_0 2 <AlicePubkey1> <BobPubkey1> 2 OP_CHECKMULTISIG
OP_ELSE
OP_0 2 <AlicePubkey2> <BobPubkey2> 2 OP_CHECKMULTISIG
OP_END
@echohack
echohack / mp4togif.sh
Created July 29, 2015 17:45
convert an mp4 to gif with ffmpeg
ffmpeg -i input_file.mp4 -vf scale=320:-1:flags=lanczos,fps=30 frames/ffout%03d.png
convert -loop 0 frames/ffout*.png output_file.gif
@johnny5550822
johnny5550822 / char-rnn nba-archive.md
Last active November 9, 2015 23:45
An automatic generated nba archive by char-rnn

Can you imagine a computer can generate an nba article?

The following is some nba articles fully-automatically generated by char-cnn, a recurrent-neural-network library thanks to Andrej Karpathy [link]. The library is awesome to easy, and very user-friendly. You should try it! :)

Basically, I wrote a python script [link] to extract past archives . And use that as the training set for the recurrent neural network.

The articles below are generated by a network trained with rougly about 2 millions character (which is an okay size; not big enough though). You can see that the generated article contains artificial author names, speeches, etc; similar to an nba archive (although the logic has to be improved, it is FUN.)

You can tune the parameter and train with a even bigger dataset using my script. And you will probably get better result! Have fun:)

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.