Skip to content

Instantly share code, notes, and snippets.

View glamrock's full-sized avatar
🐝
hacking on things at Berkman <3

Griffin Boyce glamrock

🐝
hacking on things at Berkman <3
View GitHub Profile
def insert_comma(mystring, position):
mystring[:position] + ',' + mystring[position:]
offset = 0
for magic_number in magic_numbers:
position = magic_number + offset
mystring = insert_comma(mystring, position)
offset += 1
@glamrock
glamrock / mysql-mirror.sh
Created May 9, 2018 20:09 — forked from peta/mysql-mirror.sh
Simple bash script for migrating MySQL databases (including all associated user accounts) to a remote server. Use it with care because the usage of mysqldump in this script solely relies on default values which may vary greatly on your machine. (mysqldump is a powerful tool, so don't miss `man mysqldump`).
#!/bin/bash
# Copyright (c) 2005 nixCraft project <http://cyberciti.biz/fb/>
# This script is licensed under GNU GPL version 2.0 or above
# Source: http://www.cyberciti.biz/tips/move-mysql-users-privileges-grants-from-one-host-to-new-host.html
# Author Vivek Gite <vivek@nixcraft.com>,
# Peter Geil <code@petergeil.name>
# ------------------------------------------------------------
# SETME First - local mysql user/pass
_lusr="src-db-user"
_lpass="src-db-pw"
@glamrock
glamrock / .vimrc
Created June 19, 2017 18:27 — forked from assaf/.vimrc
.vimrc
version 7.0
if &cp | set nocp | endif
let s:cpo_save=&cpo
set cpo&vim
let &cpo=s:cpo_save
unlet s:cpo_save
set cscopeprg=/usr/bin/cscope
set cscopetag
set cscopeverbose
set fileencodings=utf-8,latin1
@glamrock
glamrock / .gitconfig
Created June 6, 2017 14:06 — forked from robmiller/.gitconfig
Some useful Git aliases that I use every day
#
# Working with branches
#
# Get the current branch name (not so useful in itself, but used in
# other aliases)
branch-name = "!git rev-parse --abbrev-ref HEAD"
# Push the current branch to the remote "origin", and set it to track
# the upstream branch
publish = "!git push -u origin $(git branch-name)"
@glamrock
glamrock / tweet_dumper.py
Created March 30, 2017 16:17 — forked from yanofsky/LICENSE
A script to download all of a user's tweets into a csv
#!/usr/bin/env python
# encoding: utf-8
import tweepy #https://github.com/tweepy/tweepy
import csv
#Twitter API credentials
consumer_key = ""
consumer_secret = ""
access_key = ""
@glamrock
glamrock / tweet_sample.json
Created September 8, 2016 14:49 — forked from rmoff/tweet_sample.json
Twitter JSON sample
{"created_at":"Thu Jul 21 09:11:50 +0000 2016","id":756054063439982593,"id_str":"756054063439982593","text":"RT @Mojahedineng: #Iran #News Merkel says no one wants prolonged period of Brexit limbo https://t.co/zFb8Wl8V3q https://t.co/vY7rMeqVzx","source":"<a href=\"https://mobile.twitter.com\" rel=\"nofollow\">Mobile Web (M2)</a>","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":2395606770,"id_str":"2395606770","name":"Esmail Abobakr","screen_name":"Esmail_Abobakr","location":"City of London, England","url":"http://mojahedin.org","description":"Human rights","protected":false,"verified":false,"followers_count":512,"friends_count":356,"listed_count":25,"favourites_count":0,"statuses_count":22910,"created_at":"Tue Mar 18 04:30:09 +0000 2014","utc_offset":null,"time_zone":null,"geo_enabled":false,"lang":"en","contributors_enabled":false,"is_translator":false,"profile_background_col
@glamrock
glamrock / twitter-shared-sample.json
Created September 8, 2016 14:49
twitter-shared-sample.json
{
"took" : 335,
"timed_out" : false,
"_shards" : {
"total" : 260,
"successful" : 260,
"failed" : 0
},
"hits" : {
"total" : 290848930,
@glamrock
glamrock / twVideo.json
Created September 8, 2016 14:49 — forked from AKB428/twVideo.json
Twitter Video JSON
{
"contributors": null,
"text": "ツイッター動画投稿テスト http://t.co/y9hjEfABw1",
"geo": null,
"retweeted": false,
"in_reply_to_screen_name": null,
"possibly_sensitive": false,
"truncated": false,
"lang": "ja",
"entities": {
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.
# This is an example resource file for rTorrent. Copy to
# ~/.rtorrent.rc and enable/modify the options as needed. Remember to
# uncomment the options you wish to enable.
# Maximum and minimum number of peers to connect to per torrent.
min_peers = 1
max_peers = 100
# Same as above but for seeding completed torrents (-1 = same as downloading)