Skip to content

Instantly share code, notes, and snippets.

package main
import (
"fmt"
"time"
"github.com/bluele/factory-go/factory"
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/sqlite"
)
@wjlroe
wjlroe / README.md
Created November 20, 2012 17:16
JSON API -> CSV

Howto download a JSON API array and spit out a CSV

Tools needed

  • httpie -- easy_install httpie (probably you want to sudo easy_install httpie
  • this script -- curl -o /usr/local/bin/json-to-csv.py https://raw.github.com/gist/4119347/24adb5dcd9c025c272042653a70d25b73b485958/json-to-csv.py
  • make that executable -- chmod +x /usr/local/bin/json-to-csv.py

Here we go

@sontek
sontek / gist:1420255
Created December 1, 2011 22:09
Pyramid Example tests
import unittest
from pyramid import testing
from paste.deploy.loadwsgi import appconfig
from webtest import TestApp
from mock import Mock
from sqlalchemy import engine_from_config
from sqlalchemy.orm import sessionmaker
from app.db import Session
@shnjp
shnjp / tunnel.py
Created March 5, 2011 06:29
ssh tunnel for Fabric
"""
Fabric tunneling utilities
by shn@glucose.jp
class ForwardServer and relates things are refere Robey Pointer's paramiko example.
(http://bazaar.launchpad.net/~robey/paramiko/trunk/annotate/head%3A/demos/forward.py)
usage::
with make_tunnel('user@192.168.0.2:10022') as t:
@yyscamper
yyscamper / parseFloat.go
Created August 2, 2017 06:59
An advance ParseFloat for golang, support scientific notation, comma separated number
package main
import (
"fmt"
"math"
"strconv"
"strings"
)
func ParseFloat(str string) (float64, error) {
@nickretallack
nickretallack / env.py
Last active March 16, 2023 20:57
How to run multi-tenant migrations in alembic.
from __future__ import with_statement
from alembic import context
from sqlalchemy import engine_from_config, pool, MetaData, Table, ForeignKeyConstraint
from logging.config import fileConfig
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config
# Interpret the config file for Python logging.
@mlavin
mlavin / NOTES.rst
Created September 23, 2013 14:17
Celery Late Ack Example

Running the Example

Start the worker:

celery -A tasks worker --loglevel=info -c 2 --pidfile=celery.pid

In another terminal send 6 tasks:

python script.py
@bussiere
bussiere / compress.go
Created December 22, 2016 01:16
compress uncompress a string in golang
package main
import (
"bytes"
"compress/gzip"
"fmt"
"encoding/base64"
"io/ioutil"
)
@bubenkoff
bubenkoff / checkpoint.sh
Last active February 14, 2024 21:38
Endpoint Security VPN FULL start/stop script for Mac OS X
#!/bin/bash
#
# The reason of creating this script is that Endpoint Security VPN installs it's own application firewall kext cpfw.kext
# which prevents for example PPTP connections from this computer, which is not appropriate if you need subj connection just
# from time to time
#
# Usage: ./checkpoint.sh
#
# The script checks if Enpoint Security VPN is running. If it is, then it shuts it down, if it is not, it fires it up.
# Or, make an Automator action and paste the script.
@ebeigarts
ebeigarts / mikrotik-chateau-cell-lock.txt
Created August 28, 2021 18:00 — forked from mrskug/mikrotik-chateau-cell-lock.txt
Mikrotik Chateau LTE cell lock described. Saved for posterity, in case forum post gets deleted.
https://forums.quectel.com/t/eg12-and-freq-or-cell-lock-feature/4619
thanks.
After many test I discover all stuff.
This is example at RouterBoard Chateau, RouterOS 7 beta 8
Quectel EG12 not support frequency lock to select band at any tower.
Quectel EG12 support one and many Cell Lock’s, you can enter max 20 of CellLock’s and it select the one with the best signal and set it as primary-band.