Skip to content

Instantly share code, notes, and snippets.

@samueltc
samueltc / ubuntu16-apache2-mysql5-php4.md
Created Aug 22, 2018
Ubuntu 16.04, Apache 2.2, MySQL 5.0 and PHP 4.4
View ubuntu16-apache2-mysql5-php4.md
# lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.5 LTS
Release:	16.04
Codename:	xenial

apt-get update
apt-get upgrade
@samueltc
samueltc / publish.py
Created Jul 22, 2020
simple e-mail sender using AWS SES
View publish.py
#!/usr/bin/env python
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.base import MIMEBase
from email import encoders
import sys
import glob
import os
View edgewater.md

Edgewater 200 AW, 200A, 200AW default cli access:

login: root
password: @#$%^&*!()

Also works for Edgemarc 4550.

View megacli.txt
PERC H700 raid cli (megacli64)
Add disk to an existing virtual drive:
megacli -LDRecon -Start -r0 -Add -PhysDrv[32:5] -l<virtual drive group id> -a<adapter id>
View create-postgres-user.txt
psql postgres
CREATE ROLE new_user WITH PASSWORD 'big secure pass';
psql new_db
GRANT CONNECT ON DATABASE new_db TO new_user;
GRANT USAGE ON SCHEMA public TO new_user;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO new_user;
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO new_user;
GRANT ALL PRIVILEGES ON ALL FUNCTIONS IN SCHEMA public TO new_user;
GRANT CONNECT ON DATABASE new_db TO new_user;
@samueltc
samueltc / parse.py
Created Mar 13, 2017
visa desjardins statement to xero csv statement
View parse.py
import sys
import re
from pprint import pprint
import csv
from unidecode import unidecode
TR = re.compile(r'(?P<transaction_day>\d{2})\s+(?P<transaction_month>\d{2})\s+(?P<inscription_day>\d{2})\s+(?P<inscription_month>\d{2})\s+(?P<sequence>\d{3})\s+(?P<reference>\d{23})?(?P<payee>.*?)\s*(?P<amount>[\s0-9,]+)(?P<transaction_type>CR)?$')
FIELDS = ['Date','Amount','Payee','Description','Reference']
def parse(year):
View list_bucket.py
from pyspark import SparkContext, SparkConf
from boto.s3.connection import S3Connection
def process(key):
return key.name
if __name__=='__main__':
bucket_name = 'test-bucket'
conn = S3Connection()
bucket = conn.get_bucket(bucket_name)
View gist:adc403eddee75402b1039234ada47d49
On debian-etch-x86_64-5
Problem:
$ apt-get upgrade
Reading package lists... Done
Building dependency tree... Done
You might want to run `apt-get -f install' to correct these.
The following packages have unmet dependencies:
Segmentation fault
@samueltc
samueltc / gist:2dad265b519f6ecb4e95
Created May 9, 2014
squid cache_peer with crawlera/proxyhub
View gist:2dad265b519f6ecb4e95
Change: $scrapinhub/crawlera_hostname$, $username$, $password$ and you're ready to go.
Tested with squid3
hierarchy_stoplist cgi-bin ?
acl QUERY urlpath_regex cgi-bin \?
no_cache deny QUERY
hosts_file /etc/hosts
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern . 0 20% 4320
View gist:13e62ae4ec48e35bc098
This file has been truncated, but you can view the full file.
(function(a, b) {
function d() {
if (!n.isReady) {
try {
t.documentElement.doScroll("left")
} catch (k) {
setTimeout(d, 1);
return
}