Skip to content

Instantly share code, notes, and snippets.

View minhaz1's full-sized avatar

Minhaz Mahmud minhaz1

View GitHub Profile
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
green='\033[0;32m'
@kwlzn
kwlzn / uwsgi-pex.md
Last active June 13, 2018 15:55
uWSGI + pex

Building a test pex

setup.py

yakuza:src kw$ cat testapp/setup.py
#!/usr/bin/env python

from distutils.core import setup
@beachandbytes
beachandbytes / rtorrent.rc
Created March 28, 2015 14:21
rTorrent config. Currently moves completed downloads to folders based on label (But only if label is applied before download finishes)
# rtorrent config file ß
directory = /home/hd4/accountname/torrents/data
session = /home/hd4/accountname/.config/rtorrent/sessP5,5,load_start="~/torrents/watch/*.torrent"
port_range = 57657-57657
encryption = allow_incoming,enable_retry,try_outgoing
dht = off
peer_exchange = no
check_hash = no
execute = {sh,-c,rm -f /home/hd4/accountname/.config/rtorrent/session/rpc.socket}
scgi_local = /home/hd4/accountname/.config/rtorrent/session/rpc.socket
@supairish
supairish / gist:2951524
Created June 18, 2012 23:58
Nginx - how to limit requests by User Agent
http {
map $http_user_agent $limit_bots {
default '';
~*(google|bing|yandex|msnbot) $binary_remote_addr;
}
limit_req_zone $limit_bots zone=bots:10m rate=1r/m;
server {
@scy
scy / opening-and-closing-an-ssh-tunnel-in-a-shell-script-the-smart-way.md
Last active March 15, 2024 11:26
Opening and closing an SSH tunnel in a shell script the smart way

Opening and closing an SSH tunnel in a shell script the smart way

I recently had the following problem:

  • From an unattended shell script (called by Jenkins), run a command-line tool that accesses the MySQL database on another host.
  • That tool doesn't know that the database is on another host, plus the MySQL port on that host is firewalled and not accessible from other machines.

We didn't want to open the MySQL port to the network, but it's possible to SSH from the Jenkins machine to the MySQL machine. So, basically you would do something like

ssh -L 3306:localhost:3306 remotehost

@karpathy
karpathy / stablediffusionwalk.py
Last active March 29, 2024 09:33
hacky stablediffusion code for generating videos
"""
stable diffusion dreaming
creates hypnotic moving videos by smoothly walking randomly through the sample space
example way to run this script:
$ python stablediffusionwalk.py --prompt "blueberry spaghetti" --name blueberry
to stitch together the images, e.g.:
$ ffmpeg -r 10 -f image2 -s 512x512 -i blueberry/frame%06d.jpg -vcodec libx264 -crf 10 -pix_fmt yuv420p blueberry.mp4