Skip to content

Instantly share code, notes, and snippets.

@madumlao
madumlao / pizza.rb
Created August 13, 2021 03:42
Say pizza to drugs say no to yes.rb
# there are 10080 different permutations Here is a quick snippet in ruby for
# of the phrase: "Say pizza to drugs, generating all of them. You might
# say no to yes". want to use this to automate
# creating meme images using prawnpdf
words = %w{ say pizza to drugs say no to yes }
permutations = words.permutation.map {|p| p.join(" ") }.sort.uniq
# print out the permutations
puts permutations.first(10) + ["..."] + permutations.last(10)

Keybase proof

I hereby claim:

  • I am madumlao on github.
  • I am madumlao (https://keybase.io/madumlao) on keybase.
  • I have a public key ASAA6HAKYdu_48ILuoQacfIfy5C86_MgeeiPggQ6nXSQ6Ao

To claim this, I am signing this object:

@madumlao
madumlao / dnsmasq
Created November 15, 2018 05:37
dnsmasq workaround to prevent systemd-resolved from overwriting my DNS
#!/bin/bash
# place as your /etc/NetworkManager/dispatcher.d/dnsmasq and make executable
INTERFACE=$1
ACTION=$2
DNSMASQ_RESOLVCONF=/run/dnsmasq/resolv.conf
SYSTEMD_RESOLVCONF=/run/resolvconf/interface/systemd-resolved
if [ "$ACTION" = "up" ]; then
(
if [ "$DHCP4_DOMAIN_NAME" ]; then
@madumlao
madumlao / # httpd - 2018-10-14_22-44-01.txt
Created October 14, 2018 14:50
httpd on Ubuntu 16.04.5 LTS - Homebrew build logs
Homebrew build logs for httpd on Ubuntu 16.04.5 LTS
Build date: 2018-10-14 22:44:01
# rbenv
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
# jenv
export PATH="$HOME/.jenv/bin:$PATH"
eval "$(jenv init -)"
# compose
export PATH="$HOME/.composer/vendor/bin:$PATH"
@madumlao
madumlao / pi.py
Created April 21, 2018 02:25
Calculates and prints pi
from __future__ import print_function
def picount(n):
count = 2.0
i = 0
j = 1
for k in range(0,n):
if k % 2 == 0:
i += 2
else:
@madumlao
madumlao / fastcgi_params
Created March 20, 2018 23:17
php-fpm config
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
@madumlao
madumlao / php-fpm.project.sh
Created July 12, 2017 09:12
phpenv / php-fpm init script
#!/bin/bash
#
# start/stop php-fpm app server
### BEGIN INIT INFO
# Provides: php-fpm
# Required-Start: $remote_fs $network $syslog
# Required-Stop: $remote_fs $network $syslog
# Should-Start: $named
# Should-Stop: $named
# See http://help.github.com/ignore-files/ for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'
# Ignore bundler config.
/.bundle
# Ignore the default SQLite database.