Skip to content

Instantly share code, notes, and snippets.

@WaYdotNET
WaYdotNET / getFirafonts.sh
Created August 8, 2017 07:51 — forked from muammar/getFirafonts.sh
Download and install Fira fonts in Linux or Mac OS X
#!/bin/bash
## cf from http://programster.blogspot.com/2014/05/ubuntu-14-desktop-install-fira-sans-and.html
cd /tmp
# install unzip just in case the user doesn't already have it.
if [[ `uname` = Linux ]]; then
sudo apt-get install unzip -y
wget "http://www.carrois.com/downloads/fira_4_1/FiraFonts4106.zip"
@WaYdotNET
WaYdotNET / setup.md
Created November 11, 2017 15:24 — forked from shashankmehta/setup.md
Setup PHP and Composer on OSX via Brew

First install Brew on your MAC

  • Setup Brew: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • brew update
  • brew tap homebrew/dupes
  • brew tap homebrew/php
  • Install PHP 7.0.+ brew install php70
  • Install mcrypt: brew install mcrypt php70-mcrypt
  • Finally, install composer: brew install composer
@WaYdotNET
WaYdotNET / recurse_ftp.py
Created January 30, 2018 07:00 — forked from flibbertigibbet/recurse_ftp.py
Recursively fetch files from an FTP server directory. Here, it's downloading all the zip files found in or beneath the parent directory.
#!/usr/bin/env python
from ftplib import FTP
from time import sleep
import os
my_dirs = [] # global
my_files = [] # global
curdir = '' # global
@WaYdotNET
WaYdotNET / thread.py
Created May 31, 2018 18:22 — forked from ruedesign/thread.py
Python thread sample with handling Ctrl-C
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys, time, threading, abc
from optparse import OptionParser
def parse_options():
parser = OptionParser()
parser.add_option("-t", action="store", type="int", dest="threadNum", default=1,
help="thread count [1]")
@WaYdotNET
WaYdotNET / optimize.sh
Created August 31, 2018 14:53 — forked from danielantelo/optimize.sh
Optimise images in a folder for web
#!/bin/bash
commandExists () {
type "$1" &> /dev/null ;
}
installImageMagick() {
if commandExists brew; then
brew install imagemagick
else
git log (get the commit id that you want to reset to)
git reset --hard "commit id"
git reset --soft HEAD@{1}
git commit -m "Reverting to the state of the project at commit id"
git push
@WaYdotNET
WaYdotNET / pdf.py
Created June 11, 2019 19:20 — forked from nathandem/pdf.py
Arbitrary header/footer integration in Weasyprint PDF pages
from weasyprint import HTML, CSS
class PdfGenerator:
"""
Generate a PDF out of a rendered template, with the possibility to integrate nicely
a header and a footer if provided.
Notes:
------
@WaYdotNET
WaYdotNET / weasyprint_complex_headers.py
Created June 11, 2019 19:21 — forked from pikhovkin/weasyprint_complex_headers.py
Repeat on each page of complex headers (eg, tables) except the first page
# coding: utf-8
from weasyprint import HTML, CSS
def get_page_body(boxes):
for box in boxes:
if box.element_tag == 'body':
return box
"""
Django ORM Optimization Tips
Caveats:
* Only use optimizations that obfuscate the code if you need to.
* Not all of these tips are hard and fast rules.
* Use your judgement to determine what improvements are appropriate for your code.
"""
# ---------------------------------------------------------------------------
/* eslint-disable */
const enableOfflinePlugin = false
const __DEV__ = process.env.NODE_ENV === 'development'
const __OFFLINE__ = enableOfflinePlugin && !__DEV__
const path = require('path')
const glob = require('glob')
const webpack = require('webpack')