Skip to content

Instantly share code, notes, and snippets.

View hans's full-sized avatar

Jon Gauthier hans

View GitHub Profile
@chrisws
chrisws / a71.sh
Created July 29, 2020 21:46
Samsung A71 bloatware cleanup
#!/bin/bash
#
# USE AT YOUR OWN RISK !
#
# Based on ideas from these articles:
# https://forum.xda-developers.com/s10-plus/how-to/s10-s10-bloatware-package-list-t4054003
# https://medium.com/@kaikoenig/samsungs-bloatware-disgrace-c7d14a298ad7
#
@justinmklam
justinmklam / rsync-watch.sh
Last active May 31, 2022 15:53
Script to watch for changes in a directory and push files to a remote server. Add to /usr/local/bin for easy access (either directly or as a symlink from your home directory).
#!/usr/bin/env bash
"""Monitor a directory and rsync to a remote host on file change.
Example usage:
./rsync-watch.sh pi@raspberrypi.local . /home/pi/myproject
"""
RED=`tput setaf 1`
GREEN=`tput setaf 2`
YELLOW=`tput setaf 3`
@erikbern
erikbern / install-tensorflow.sh
Last active June 26, 2023 00:40
Installing TensorFlow on EC2
# Note – this is not a bash script (some of the steps require reboot)
# I named it .sh just so Github does correct syntax highlighting.
#
# This is also available as an AMI in us-east-1 (virginia): ami-cf5028a5
#
# The CUDA part is mostly based on this excellent blog post:
# http://tleyden.github.io/blog/2014/10/25/cuda-6-dot-5-on-aws-gpu-instance-running-ubuntu-14-dot-04/
# Install various packages
sudo apt-get update
@karpathy
karpathy / min-char-rnn.py
Last active June 11, 2024 01:44
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@brandonb927
brandonb927 / osx-for-hackers.sh
Last active June 13, 2024 02:39
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx
@crizCraig
crizCraig / basemodel.py
Created July 14, 2012 21:51
GAE Sharded counter
class BaseShardedCountModel(BaseModel):
# services
# - in-memory counts
# - getting counter name from entity
# - check for transition
def counter(self, name):
from lib.shardedcounter import Counter
return Counter(str(name + '_' + str(self.key().id())))
def getshardedcount(self, name):
;; hans's solution to Rotate Sequence
;; https://4clojure.com/problem/44
(fn [rot xs]
(let [rot (mod rot (count xs))
rot (if (neg? rot) (+ (count xs) rot) rot)]
(loop [rot rot at-end [] x (first xs) xs (rest xs)]
(if (= rot 0)
(concat (cons x xs) at-end)
(recur (dec rot) (conj at-end x) (first xs) (rest xs))))))