Skip to content

Instantly share code, notes, and snippets.

View apiguy's full-sized avatar

Freedom Dumlao apiguy

View GitHub Profile
@apiguy
apiguy / install_zscaler_arch.sh
Last active July 16, 2025 13:39
ZScaler installation script for Arch Linux
#!/bin/bash
# Complete ZScaler installation script for Arch Linux
# Confirmed to work with ZScaler 3.7.2
# Make sure the ZScaler .run file is in the current working directory.
# The QT Dependencies take forever to install... make sure you've got enough battery!
echo "Installing ZScaler on Arch Linux..."
echo "================================="
@apiguy
apiguy / CONVENTIONS.md
Last active August 1, 2025 03:39 — forked from peterc/CONVENTIONS.md
CONVENTIONS.md file for AI Rails 8 development

This is a good start, but we need to add more info about tools and such, like Mise and Docker

  • You MUST NOT try and generate a Rails app from scratch on your own by generating each file. For a NEW app you MUST use rails new first to generate all of the boilerplate files necessary.
  • Create an app in the current directory with rails new .
  • Use Tailwind CSS for styling. Use --css tailwind as an option on the rails new call to do this automatically.
  • Use Ruby 3.2+ and Rails 8.0+ practices.
  • Use the default Minitest approach for testing, do not use RSpec.
  • Default to using SQLite in development. rails new will do this automatically but take care if you write any custom SQL that it is SQLite compatible.
  • An app can be built with a devcontainer such as rails new myapp --devcontainer but only do this if requested directly.
  • Rails apps have a lot of directories to consider, such as app, config, db, etc.
require "strscan"
class Scanner
TOK = []
TOK["{".ord] = :LBRACE; TOK["}".ord] = :RBRACE; TOK[";".ord] = :SEMI
def initialize data
@scan = StringScanner.new data
@prev_pos = @scan.pos
end

Keybase proof

I hereby claim:

  • I am apiguy on github.
  • I am apiguy (https://keybase.io/apiguy) on keybase.
  • I have a public key whose fingerprint is B007 ED9E C641 A8C8 BDAA 3EE0 1BAF 9671 E675 C159

To claim this, I am signing this object:

@apiguy
apiguy / float-issue.py
Created October 29, 2013 21:10
Demonstrates how floats can be inaccurate
time = .0
seconds = 0
while True:
time += .1
seconds = int(time)
print "---------------"
print "Time to str: ", time
print "Time to int: ", int(time)
print "Seconds: ", seconds
@apiguy
apiguy / case_sensitivity_perf_test.py
Last active December 19, 2015 16:39
Comparison of performance of case sensitivity comparisons in python
import timeit
setup = """
import re
from itertools import ifilter
x = "active"
regex = re.compile(x, re.IGNORECASE)
def uppertest():
@apiguy
apiguy / if_filter.py
Last active December 19, 2015 07:28
If template filter for Jinja2
def if_(value, truth_test):
return value if truth_test else None
# Usage
"""
{{ active|if_(row.first) }}
"""
#!/bin/bash
###############################################
# To use:
# https://raw.github.com/gist/2776351/???
# chmod 777 install_postgresql.sh
# ./install_postgresql.sh
###############################################
echo "*****************************************"
echo " Installing PostgreSQL"
echo "*****************************************"
#!/bin/bash
redis_version=2.6.13
# from here: http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/
# and here: https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server
###############################################
# To use:
# wget https://gist.github.com/apiguy/5669466/raw/952b5221f46db37d1cda8fb04c6a23356b9c6338/install-redis.sh
# chmod +x install-redis.sh
# ./install-redis.sh