Skip to content

Instantly share code, notes, and snippets.

Marc Esher marcesher

View GitHub Profile
marcesher / rot13.go
Created Jan 8, 2014
go tour rot13 exercise I imagine the strings.ToLower version is much slower. experimenting is all.
View rot13.go
package main
import (
type rot13Reader struct {
r io.Reader
marcesher / go_tour_http_handle_exercise.go
Created Jan 8, 2014
simple solution to go tour exercise for http.Handle
View go_tour_http_handle_exercise.go
package main
import (
type String string
type Hello struct {
Greeting string
marcesher / slightly_better_wordcount.go
Last active Jan 1, 2016
ugly-ass solution for Go wordcount map exercise
View slightly_better_wordcount.go
package main
import (
func WordCount(s string) map[string]int {
m := make(map [string] int)
for _, v := range strings.Fields(s) {
marcesher / go_tour_slice_exercise.go
Created Dec 29, 2013
simple solution to Go tour slide 35, exercise on slices. This prints a blue gradient
View go_tour_slice_exercise.go
package main
import (
func Pic(dx, dy int) [][]uint8 {
p := make([][] uint8, dy)
for i :=0; i < dy; i++ {
marcesher / gist:7168642
Last active May 24, 2020
install 7zip on linux
View gist:7168642
In this case, in AWS Linux:
yum-config-manager --enable epel
yum install -y p7ip
cp /usr/bin/7za /usr/bin/7z
marcesher / replset_port_change.js
Last active Dec 22, 2015
quickie: change mongo ports in repl set config
View replset_port_change.js
use local
cfg = db.system.replset.findOne()
cfg.members.forEach( function(m) { var tmp =,12345); print(tmp); = tmp; } )
db.system.replset.update({"_id":cfg['_id']}, cfg)
marcesher / gist:5151652
Created Mar 13, 2013
regex search/replace for django direct_to_template and redirect_to upgrade in 1.5
View gist:5151652
direct_to_template, \{'template':(.*?)}
redirect_to, \{'url': (.*?)}
marcesher / notes.txt
Last active Dec 10, 2015
Notes and questions about static assets in django
View notes.txt
my notes on django static assets during development. This is not related to collectstatic or configuring the webserver:
1) created new /static/ directory under 'mysite'
2) put some stuff in there... css, images
How to include in templates:
1) Using the {{STATIC_URL}} seting
--requires Zero additional configuration unlike {% static "blah.css" %}
marcesher / classpath.xml
Created Nov 29, 2012
database migration automation example
View classpath.xml
<!-- jtds.jar, used to connect to SQL Server, is in 'lib' -->
<path id="project.classpath">
<fileset dir="lib">
<include name="*.jar" />
marcesher / state_is_a_bug.txt
Created Nov 9, 2012
State Is a Bug : Questions
View state_is_a_bug.txt
Joe, thanks for responding.
I'm most interested in what are perhaps pedestrian issues, but they're issues (for me) nonetheless. You mentioned "outsourcing" session management... where can I read more on that?
Take the simple case of: I'm a user on your system. I'm logged in. I'm doing things. The server I'm on disappears while the screen I'm reading is currently loading.
What happens? Do I see an error? Am I sent to a new machine, with all my session state in tact, and the screen I was reading simply reloads?
Or take perhaps a different architecture where a machine isn't brought down until all its users have been successfully moved to other servers. For example, perhaps our configuration is such that we have N instances, and we do a rolling code push to those instances. User A is on Server 5, which has the old code. We need to get that user to Server 2, which has the new code, along with all of his state. Once all users are off of Server 5, the deploy then moves to Server 5 as well and then Server 5 is b
You can’t perform that action at this time.